3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 0 => array('id' => 5, 'title' => '', 'nomor' => 1), 1 => array('id' => 6, 'title' => '', 'nomor' => 2) ); $formatted_array = array(); foreach($array as $element) { $formatted_array[$element['nomor']] = $element; } print_r($formatted_array);
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Array ( [1] => Array ( [id] => 5 [title] => [nomor] => 1 ) [2] => Array ( [id] => 6 [title] => [nomor] => 2 ) )

preferences:
106.53 ms | 403 KiB | 212 Q