All of us can use mysql_fetch_array() function and know it returns
an array that corresponds to the fetched row.
Ok, I want to code a function to return an array and I want to use it
in the same mannar of using mysql_fetch_array().
this will be clearly shown in the following code:
<?
function myarr($x)
{
for ($i = 1; $i < 10; ++$i)
{
$result[$i] = $x/$i;
}
}
?>
Now I'd like to use this function like this inside the script
<?
$arr = myarr(6);// I need here $arr to an array from the loop inside myarr()
echo($arr[2]);
?>
So the result will be equal to 3, due to $x = 6, $i = 2 and 6/3 = 2
However, till this moment I cannot handle myarr($x) to return an array as
resources.
What have I add to its code to do that?
Please I need Your Help!😕