3v4l.org

run code in 300+ PHP versions simultaneously
<?php $workers = array(); $workers[0] = array('a' =>1, 'b'=> 34, 'unitId'=>4); $workers[1] = array('a' =>1, 'b'=> 34, 'unitId'=>5); $workers[2] = array('a' =>1, 'b'=> 34, 'unitId'=>6); $workers[3] = array('a' =>1, 'b'=> 34, 'unitId'=>7); $workers[4] = array('a' =>1, 'b'=> 34, 'unitId'=>8); $workers[5] = array('a' =>1, 'b'=> 34, 'unitId'=>9); $units = array(); foreach($workers as $worker){ $units[] = $worker['unitId']; } var_dump($units);

preferences:
27.6 ms | 402 KiB | 5 Q