WebToTell - Best Forum Site for PHP Developer | Best PHP online Community | PHP Applications Discussion Forum

Full Version: Return Multiple Values From A Function in PHP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
A function can not return multiple values, but similar results can be obtained by returning an array. Solution is very simple and straight forward.
PHP Code:
PHP Code:
function returnMultipleValues(){
$result = array() ;

$result['first'] = "multiple value 1" ;
$result['second']= "multiple value 2" ;

$thisIsMultiple returnMultipleValues() ;
$thisIsMultiple['first'] ."<br>" ;
$thisIsMultiple['second'] ."<br>" ;