0
Q:

php return array

<?php

function data() {
    $out[0] = "abc";
    $out[1] = "def";
    $out[2] = "ghi";
    return $out;
}

$data = data();
foreach($data as $items){
    echo $items;
}
1
function myfunc(){
    $arr = array();
    $arr[] = 'value0';
    $arr['key1'] = 'value1';
    $arr['key2'] = 'value2';
    $arr[] = 'value3';
    return $arr;
}
0

New to Communities?

Join the community