[ create a new paste ] login | about

Link: http://codepad.org/XpDBWjLI    [ raw code | output | fork ]

PHP, pasted on Sep 25:
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);


Output:
1
2
3
4
5
Array
(
    [0] => 10
    [1] => 11
)


Create a new paste based on this one


Comments: