3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [ 1 => [ [ 'key' => 'fe', 'name' => 'En plantilla a dedicación completa', 'dedication' => 2, 'relationship' =>2 ], [ 'key' => 'ff', 'name' => 'Freelance a dedicación completa', 'dedication' => 2, 'relationship' => 2 ], ], 2 => [ [ 'name' => 'En Plantilla', 'childs' => [ [ 'key' => 'pem', 'name' => 'Mañanas', 'dedication' => 1, 'relationship' => 2, 'shiftPreference' => 3 ], [ 'key' => 'pea', 'name' => 'Tardes', 'dedication' => 1, 'relationship' => 2, 'shiftPreference' => 3 ], [ 'key' => 'ped', 'name' => 'Indistinto', 'dedication' => 4, 'relationship' => 5, 'shiftPreference' => 1 ], ], ], [ 'name' => 'Freelance', 'childs' => [ [ 'name' => 'Mañanas', 'childs' => [ [ 'key' => 'pfmm', 'name' => 'Más de 3 horas/día', 'dedication' => 1, 'relationship' => 2, 'shiftPreference' => 3, 'hoursOfService' => 5 ], [ 'key' => 'pfml', 'name' => 'Menos de 3 horas/día', 'parent' => 8, 'dedication' => 2, 'relationship' => 5, 'shiftPreference' => 32, 'hoursOfService' => 32 ], ], ], [ 'name' => 'Tardes', 'childs' => [ [ 'key' => 'pfam', 'name' => 'Más de 3 horas/día', 'dedication' => 1, 'relationship' => 2, 'shiftPreference' => 6, 'hoursOfService' => 4 ], [ 'key' => 'pfal', 'name' => 'Menos de 3 horas/día', 'dedication' => 3, 'relationship' => 5, 'shiftPreference' => 3, 'hoursOfService' => 1 ], ], ], [ 'name' => 'Indistinto', 'childs' => [ [ 'key' => 'pfdm', 'name' => 'Más de 3 horas/día', 'dedication' => 21, 'relationship' => 6, 'shiftPreference' => 25, 'hoursOfService' => 2 ], [ 'key' => 'pfdl', 'name' => 'Menos de 3 horas/día', 'dedication' => 434, 'relationship' => 2245243, 'shiftPreference' => 543, 'hoursOfService' => 324 ], ], ], ], ], ], ]; $results = $a[1]; array_walk_recursive($results, function(&$a){ unset($a['dedication'], $a['relationship'], $a['shiftPreference'], $a['hoursOfService']); }); var_dump($results); var_dump($a);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Cannot unset string offsets in /in/4LdKf:118 Stack trace: #0 [internal function]: {closure}('fe', 'key') #1 /in/4LdKf(117): array_walk_recursive(Array, Object(Closure)) #2 {main} thrown in /in/4LdKf on line 118
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
63.01 ms | 401 KiB | 8 Q