3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myarray = Array ( Array ( 'user_id' => 21, 'email' => 'momod@modara.com', 'brand' => Array ('GOFUEL_W','GOFUEL_USD_W')), Array ( 'user_id' => 22, 'email' => 'hemisphere@modara.com', 'brand' => Array ('GOFUEL_W')), Array ( 'user_id' => 23, 'email' => 'madoka@modara.com', 'brand' => Array ('GOFUEL_W','GOFUEL_USD_W','GOFUEL_BGD_W') ) ); foreach ($array as &$element) { if ($element['user_id'] != 22) continue; // skip this $element['brand'][] = "GO_FUEL_SGD_W"; break; // we are finished, don't need the elements after this one } print_r($myarray);

preferences:
46.68 ms | 402 KiB | 5 Q