1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<?php $categories['t-shirts'] = 10; $categories['shorts'] = 11; $clothing[0] = 't-shirts'; $clothing[1] = 'shorts'; foreach($clothing as $key => $val){ if(isset($categories[$val])){ $clothing[$key] = $categories[$val]; } } print_r($clothing);
1 2 3 4 5
Array ( [0] => 10 [1] => 11 )