phpbar.de logo

Mailinglisten-Archive

[php] Arrays | Werte vergleichen

[php] Arrays | Werte vergleichen

Sebastian Mendel lists at sebastianmendel.de
Mit Okt 22 14:38:16 CEST 2008


On 2008-10-22 10:31, Olaf Gleba wrote:
> [...]
> for ($i = 0; $i<  count($allboxes); $i++) {
> 	if ($allboxes[$i]['name'] == $boxes[$i]['name']) {
> 		$_box = $box['name'].'_copy_of_'.strtolower($allboxes[$i]
> ['page_name']);
> 	} else {
> 		$_box = $box['name'].'_nope';
> 	}
> }


so richtig versteh ichs nicht, aber:


foreach ($allboxes as $key => $dummy) {
	if ($allboxes[$key]['name'] == $boxes[$key]['name']) {
		// copy
	} else {
		//
	}
}


oder:

foreach ($allboxes as $each_allboxes) {
     foreach ($boxes as $each_boxes) {
     	if ($each_allboxes['name'] == $each_boxes['name']) {
     		// copy
     	} else {
     		//
     	}
     }
}

-- 
Sebastian Mendel

php::bar PHP Wiki   -   Listenarchive