tags:

views:

57

answers:

3

Hi All,

i want to do this type

in my form i have check box array and the function i want to call as the size of check box array, now all is ok simple one time calling.

but i want to call the function as above, and store the function return value in one array

as function return array so i want to do like this

for user id 1->callfunction return array
user id 2->callfunction return array .... ....

i have try to used the array_push but i does not get any result

here is my code

$track = array();

for($i=0;$i<sizeof($usr);$i++)
        {
            if (!empty($start) and !empty($end))
            {

                $track_e = $tracker->getProjectTrack($id, $usr[$i], $taski, $start, $end);

                //$track = $tracker->getProjectTrack($id, $usr, $taski, $start, $end);
            }

            $track=array_push($track,$track_e);

        }
+2  A: 

if you want to go through array, use foreach

$track = array();
if (!empty($start) and !empty($end)){  
 foreach ($usr as $u){
  array_push($track,$tracker->getProjectTrack($id, $u, $taski, $start, $end);
 }
}
codez
Thanx it works but it not added element in desire way like this
Rajendra Banker
A: 

Array ( [0] => Array ( [0] => 5 ) [1] => Array ( [0] => 6 ) [2] => Array ( [0] => 7 ) )

instead of this it returns

Array ( [0] => Array ( [0] => Array ( [0] => 7 ) ) [1] => Array ( [0] => Array ( [0] => 9) ) )

something like that

so i want to return it in as same first one.

Rajendra Banker
Please do not supply additional information to your question as an answer. SO does not work like a forum. Please use the [Edit](http://stackoverflow.com/posts/3123038/edit) link below your question
Gordon
How come you want to have an array with [0] elements that simply point to a one element array? Wouldn't the first one make a little bit more sense? Please clarify how exactly you want these arrays to be structured with some more examples and more importantly, WHY it needs to be like that.
SHC
+1  A: 
amphetamachine