Returning array from php function

How to return array from php function

Please add the code you are having trouble with, it shouldn’t be any problem returning an array.

[php]function getArray() {
$array = [1,2,3];
return $array;
}[/php]

or if you’re on an old php version

[php]function getArray() {
$array = array(1,2,3);
return $array;
}[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service