3v4l.org

run code in 500+ PHP versions simultaneously
<?php $data = [ ["username" => "erick","location" => ["singapore"],"province" => ["jatim"]], ["username" => "thomas","location" => ["ukraina"],"province" => ["anonymouse"]] ]; $result = array_map(function ($arr) { return array_map(function($inner) { return is_array($inner) ? $inner[0] : $inner; }, $arr); }, $data); var_export($result);
Output for 7.4.32, 8.1.23 - 8.1.34, 8.2.10 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.21, 8.5.0 - 8.5.7
array ( 0 => array ( 'username' => 'erick', 'location' => 'singapore', 'province' => 'jatim', ), 1 => array ( 'username' => 'thomas', 'location' => 'ukraina', 'province' => 'anonymouse', ), )

preferences:
72.88 ms | 882 KiB | 4 Q