Re: Assign values in foreach-loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



sorry,

i didn't fully answer the questions... if i understand your multidimensional array correctly, your code should be something like:

foreach ($_SESSION['arr1'] as $key => $arr1) {
   foreach ($_SESSION['arr2'] as $arr2) {
       if ($arr1['id'] == $arr2['id']) {
           $_SESSION['arr1'][$key]['selected'] = true;
       }
   }   }

Jordan



On Sep 7, 2005, at 12:22 PM, Jordan Miller wrote:

foreach ($_SESSION['arr1'] as $arr1) {
   foreach ($_SESSION['arr2'] as $arr2) {
       if ($arr1['id'] == $arr2['id']) {
           $arr1['selected'] = true;
       }
   }   }


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux