In Action

Php Toycode - Function returning a list

Simple example demonstrating how to return a list from a function. This comes in handy when you need to return more than one argument from a function.

forloop



Toycode

Php Code

Just cut-n-paste to reuse.

     
<?php
function return_more() {
	return array('first', 'second');
}

list($ret1, $ret2) = return_more();

echo $ret1.'<br>';
echo $ret2.'<br>';

?>