3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $old = [ 'name' => 'Dae', 'dob' => '1970-01-01', 'blah' => 'blah', ]; function convertRow($row) { $new = [ 'table1' => [ 'name' => $old['name'], 'dob' => $old['dob'], ], 'table2' => [ 'blah' => $old['blah'], ], ]; } $data = convertRow($old); // Now do your inserts $firstTableData = $data['table1']; $secondTableData = $data['table2']; var_dump($firstTableData, $secondTableData);
based on LgCeb
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0rc3
Notice: Undefined variable: old in /in/FC15k on line 13 Notice: Undefined variable: old in /in/FC15k on line 14 Notice: Undefined variable: old in /in/FC15k on line 17 NULL NULL