PHP Programing language

How can returning list from the Function
Previous Home Next
In this function using for list and create a list for returning from the function.
<html>
<head>
<title>Returning list from Functions  </title>
</head>
<body>
<h1>Returning list from Functions </h1>
<?php
list ($first,$second,$third) = create_list (3);
echo "Here the first list,<br>";
echo "$first, $second, $third <br>";
list ($first,$second,$third,$fourth) =
create_list(4);
echo "Here the second list,<br>";
echo "$first, $second, $third <br>";
function create_list($number)
{
for ($loop_counter = 0; $loop_counter 
	< $number; $loop_counter++)
{
$array[] = $loop_counter;
}
return $array;
}
?>
</body>
</html>

Output:

Previous Home Next