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' => '%s is not a valid %s', 'missing' => '%s is a required %s - other functions have dependencies on it', ]); $errors = []; foreach ($e as $type => $subtypes) { if (!isset(ERROR_LOOKUP[$type])) { continue; } foreach ($subtypes as $subtype => $entry) { foreach ($entry as $string) { $errors[] = sprintf(ERROR_LOOKUP[$type], $subtype, $string); } } } echo implode("\n", $errors);
Output for git.master, git.master_jit, rfc.property-hooks
key is not a valid a123 key is not a valid a456 color is not a valid red key is a required b72 - other functions have dependencies on it color is a required blue - other functions have dependencies on it color is a required green - 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:
70.86 ms | 401 KiB | 8 Q