hello all,
i made a function that supposed to feed dual array
my problam is that the varibal is visibale inside the function but when it return it dies with it. :(
thats what i want the function to return
[CODE=php]function sort($n,$mytime stemp,$mytoatl) {
$ts[$n][0]=$mytimestemp;
$total[$n][0]=$mytotal;
return;
}[/CODE]
then when i want to use the data i get notice that its empty
[CODE=php]print_r($ts);
print_r($total) ;[/CODE]
i know the first time i use $ts and $total is inside the function
but even if i first put them at the top of the code or right affter the functin or righr before the function still they dont get updated with $mytimestemp and $mytotal.
i try to declare it like that :
A:
[CODE=php]$ts;
$total;[/CODE]B:
[CODE=php]$ts = array();
$total = array();[/CODE]C:
[CODE=php]global $ts;
global $total;[/CODE]
is it because its array in array?
i made a function that supposed to feed dual array
my problam is that the varibal is visibale inside the function but when it return it dies with it. :(
thats what i want the function to return
[CODE=php]function sort($n,$mytime stemp,$mytoatl) {
$ts[$n][0]=$mytimestemp;
$total[$n][0]=$mytotal;
return;
}[/CODE]
then when i want to use the data i get notice that its empty
[CODE=php]print_r($ts);
print_r($total) ;[/CODE]
i know the first time i use $ts and $total is inside the function
but even if i first put them at the top of the code or right affter the functin or righr before the function still they dont get updated with $mytimestemp and $mytotal.
i try to declare it like that :
A:
[CODE=php]$ts;
$total;[/CODE]B:
[CODE=php]$ts = array();
$total = array();[/CODE]C:
[CODE=php]global $ts;
global $total;[/CODE]
is it because its array in array?
Comment