Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php return multiple variables from function

<?php
function small_numbers()
{
    return [0, 1, 2];
}
// Array destructuring will collect each member of the array individually
[$zero, $one, $two] = small_numbers();

// Prior to 7.1.0, the only equivalent alternative is using list() construct
list($zero, $one, $two) = small_numbers();

?>
Source by www.php.net #
 
PREVIOUS NEXT
Tagged: #php #return #multiple #variables #function
ADD COMMENT
Topic
Name
6+3 =