3v4l.org

run code in 300+ PHP versions simultaneously
<?php $phonecodes['pl'] = 48; $country= 'pl'; $tel = '+4812321312312312'; function checkCountryCode($tel, $part) { global $phonecodes, $country; for ($i = 1; $i <= 3; $i++) { $codeToCheck = substr($tel, 1, $i); foreach ($phonecodes as $key => $val) { if ($codeToCheck == $val) { $code = c; echo $code; switch($part){ case 'phonecode': echo $key; break; case 'a': echo $val; break; case 'd': echo 'dupa'; break; } } } } if ($code == '') echo $country; } checkCountryCode($tel, 'phonecode');
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Undefined constant "c" in /in/aZIcp:13 Stack trace: #0 /in/aZIcp(32): checkCountryCode('+48123213123123...', 'phonecode') #1 {main} thrown in /in/aZIcp on line 13
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:
47.72 ms | 401 KiB | 8 Q