3v4l.org

run code in 500+ PHP versions simultaneously
<?php $existing_array = [ "ROWID" =>[ 0 => 0, 1 => 1, 2 => 2 ], "First Name" => [ 0 => "BILLY", 1 => "SALLY", 2 => "TYLER" ], "Last Name" => [ 0 => "RAY", 1 => "SUE", 2 => "TERRIER" ], "Middle Name" =>[ 0 => "B.", 1 => "S.", 2 => "T." ] ]; $expected_array = ['ROWID'=>$existing_array['ROWID'],'First Name'=>$existing_array['First Name'],'Middle Name'=>$existing_array['Middle Name'],'Last Name'=>$existing_array['Last Name']]; print_r($expected_array);
Output for 5.6.38, 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.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Array ( [ROWID] => Array ( [0] => 0 [1] => 1 [2] => 2 ) [First Name] => Array ( [0] => BILLY [1] => SALLY [2] => TYLER ) [Middle Name] => Array ( [0] => B. [1] => S. [2] => T. ) [Last Name] => Array ( [0] => RAY [1] => SUE [2] => TERRIER ) )

preferences:
97.57 ms | 1696 KiB | 4 Q