3v4l.org

run code in 300+ PHP versions simultaneously
<?php function checkOperation(string $operation): ?string { if (!preg_match('/^\d+([a-zA-Z]+)\+\d+([a-zA-Z]+)$/', $operation, $matches)) { return null; } if (array_count_values(str_split($matches[1])) != array_count_values(str_split($matches[2]))) { return null; } return $operation; } var_dump(checkOperation('5p+3p')); echo PHP_EOL; var_dump(checkOperation('5AB+3AB')); echo PHP_EOL; var_dump(checkOperation('5AB+3BA')); echo PHP_EOL; var_dump(checkOperation('5p+3q'));
Output for git.master, git.master_jit, rfc.property-hooks
string(5) "5p+3p" string(7) "5AB+3AB" string(7) "5AB+3BA" NULL

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:
29.54 ms | 405 KiB | 5 Q