3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $original = array ( 0 => array ( 'id' => '63716', 'address' => '62.210.204.189', 'reverse' => NULL, 'server_id' => '51560', ), 1 => array ( 'id' => '63835', 'address' => '62.210.203.55', 'reverse' => '62-210-203-55.rev.poneytelecom.eu.', 'server_id' => '51674', ), 2 => array ( 'id' => '63836', 'address' => '62.210.203.56', 'reverse' => 'cloud.guyellia.com.', 'server_id' => '51675', ), // ... ); $transformed = []; foreach ($original as &$a) { $transformed[$a['server_id']] = $a; } unset($original); var_export($transformed);
based on rYAaB
Output for 5.5.0 - 7.3.0beta1
array ( 51560 => array ( 'id' => '63716', 'address' => '62.210.204.189', 'reverse' => NULL, 'server_id' => '51560', ), 51674 => array ( 'id' => '63835', 'address' => '62.210.203.55', 'reverse' => '62-210-203-55.rev.poneytelecom.eu.', 'server_id' => '51674', ), 51675 => array ( 'id' => '63836', 'address' => '62.210.203.56', 'reverse' => 'cloud.guyellia.com.', 'server_id' => '51675', ), )