Re: Assign values in foreach-loop

From: Date: Wed, 07 Sep 2005 17:28:43 +0000
Subject: Re: Assign values in foreach-loop
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-221980@lists.php.net to get a copy of this message
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;
       }
} }


« previous php.general (#221980) next »