3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [ 1 => [ [ 'key' => 'fe', 'name' => 'En plantilla a dedicación completa', 'dedication' => self::FULLTIME, 'relationship' => self::EMPLOYEE ], [ 'key' => 'ff', 'name' => 'Freelance a dedicación completa', 'dedication' => self::FULLTIME, 'relationship' => self::FREELANCER ], ], 2 => [ [ 'name' => 'En Plantilla', 'childs' => [ [ 'key' => 'pem', 'name' => 'Mañanas', 'dedication' => self::PARTTIME, 'relationship' => self::EMPLOYEE, 'shiftPreference' => self::MORNING_SHIFT ], [ 'key' => 'pea', 'name' => 'Tardes', 'dedication' => self::PARTTIME, 'relationship' => self::EMPLOYEE, 'shiftPreference' => self::AFTERNOON_SHIFT ], [ 'key' => 'ped', 'name' => 'Indistinto', 'dedication' => self::PARTTIME, 'relationship' => self::EMPLOYEE, 'shiftPreference' => self::DOES_NOT_MATTER ], ], ], [ 'name' => 'Freelance', 'childs' => [ [ 'name' => 'Mañanas', 'childs' => [ [ 'key' => 'pfmm', 'name' => 'Más de 3 horas/día', 'dedication' => self::PARTTIME, 'relationship' => self::FREELANCER, 'shiftPreference' => self::MORNING_SHIFT, 'hoursOfService' => self::MORE_THAN_3H ], [ 'key' => 'pfml', 'name' => 'Menos de 3 horas/día', 'parent' => 8, 'dedication' => self::PARTTIME, 'relationship' => self::FREELANCER, 'shiftPreference' => self::MORNING_SHIFT, 'hoursOfService' => self::LESS_THAN_3H ], ], ], [ 'name' => 'Tardes', 'childs' => [ [ 'key' => 'pfam', 'name' => 'Más de 3 horas/día', 'dedication' => self::PARTTIME, 'relationship' => self::FREELANCER, 'shiftPreference' => self::AFTERNOON_SHIFT, 'hoursOfService' => self::MORE_THAN_3H ], [ 'key' => 'pfal', 'name' => 'Menos de 3 horas/día', 'dedication' => self::PARTTIME, 'relationship' => self::FREELANCER, 'shiftPreference' => self::AFTERNOON_SHIFT, 'hoursOfService' => self::LESS_THAN_3H ], ], ], [ 'name' => 'Indistinto', 'childs' => [ [ 'key' => 'pfdm', 'name' => 'Más de 3 horas/día', 'dedication' => self::PARTTIME, 'relationship' => self::FREELANCER, 'shiftPreference' => self::DOES_NOT_MATTER, 'hoursOfService' => self::MORE_THAN_3H ], [ 'key' => 'pfdl', 'name' => 'Menos de 3 horas/día', 'dedication' => self::PARTTIME, 'relationship' => self::FREELANCER, 'shiftPreference' => self::DOES_NOT_MATTER, 'hoursOfService' => self::LESS_THAN_3H ], ], ], ], ], ], ]; $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 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught Error: Cannot access "self" when no class scope is active in /in/OHq93:7 Stack trace: #0 {main} thrown in /in/OHq93 on line 7
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught Error: Cannot access "self" when no class scope is active in /in/OHq93:7 Stack trace: #0 {main} thrown in /in/OHq93 on line 7
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught Error: Cannot access self:: when no class scope is active in /in/OHq93:7 Stack trace: #0 {main} thrown in /in/OHq93 on line 7
Process exited with code 255.
Output for 5.4.7 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
Fatal error: Cannot access self:: when no class scope is active in /in/OHq93 on line 7
Process exited with code 255.

preferences:
197.02 ms | 402 KiB | 236 Q