appending to associative array PHP

Undermine2k

I must be missing something obvious: I'm returning an associative array after my query runs, and for each nested array I wish to append $child['Is_Child'] = '0'; When I print out the $child array it is correct, but the $child_participants array does not have it appended; why?

if ($query->num_rows() > 0)
        {
           $child_participants= $query->result_array();
           foreach($child_participants as $child) 
             {
               $child['Is_Child'] = '0';
             }

           return $child_participants;

         }
tigrang

Pass a reference instead of value by using &$child

foreach($child_participants as &$child)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related