how to make php fuction return 2 values code example
Example 1: return two variables php
function getXYZ()
{
return array(4,5,6);
}
list($x,$y,$z) = getXYZ();
// Afterwards: $x == 4 && $y == 5 && $z == 6
// (This will hold for all samples unless otherwise noted)
Example 2: php function return multiple values
// Function to swap two numbers
function swap( $x, $y ) {
return array( $y, $x );
}