3v4l.org

run code in 300+ PHP versions simultaneously
<?php $column_names= [ 0=>'student_id', 1=>'college_name', 2=>'name' ]; $student_details=[ 0=>[ 0=>'1', 1=>'xxx', 2=>'aaa' ], 1=>[ 0=>'2', 1=>'yyy', 2=>'bbb' ] ]; foreach($student_details as &$sub){ $sub = array_combine($column_names, $sub); } Var_dump($student_details);

preferences:
30.38 ms | 402 KiB | 5 Q