3v4l.org

run code in 300+ PHP versions simultaneously
<?php $e['invalid']['key'][] = 'a123'; $e['invalid']['key'][] = 'a456'; $e['invalid']['color'][] = 'red'; $e['missing']['key'][] = 'b72'; $e['missing']['color'][] = 'blue'; $e['missing']['color'][] = 'green'; define("ERROR_LOOKUP", [ 'invalid' => [' is not a valid ', ''], 'missing' => [' is a required ', ' - other functions have dependencies on it'], ]); define("ERROR_TYPES", array_keys(ERROR_LOOKUP)); $errors = []; foreach ($e as $type => $subtypes) { if (!in_array($type, ERROR_TYPES)) { continue; } foreach ($subtypes as $subtype => $entry) { foreach ($entry as $string) { $errors[] = $string . implode($subtype, ERROR_LOOKUP[$type]); } } } echo implode("\n", $errors);
Output for git.master, git.master_jit, rfc.property-hooks
a123 is not a valid key a456 is not a valid key red is not a valid color b72 is a required key - other functions have dependencies on it blue is a required color - other functions have dependencies on it green is a required color - other functions have dependencies on it

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:
116.86 ms | 406 KiB | 5 Q