I am trying to pass on an array from a function on one sheet into a new array on another php sheet.
Here’s what i have:
The function is:
//the arr.php file
<?php
function search($var){
$var;
$a=array();
$a[0]=$var+1;
$a[1]=$var+2;
$a[2]=$var+3;
$a[3]=$var+4;
return $a;
}
?>
The second sheet is:
<?php
include ('arr.php');
$n=4;
for($i=0;$i<$n;$i++)
{
$temp=search(3);
$thearrayfromarr[$i]=$temp;//doesn't work
print_r($thearrayfromarr[$i]);//doesn't work
}
?>
I want the second sheet to have an array variable which i can echo that will output
the $a array data from the search function.
So that, for example, when i type
echo thearrayfromarr[0]; // It will have the value of $a[0] echo'd to me
Your function isn’t
returning anything: