3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ReformatPhoneNumber($number) { if(strlen($number) > 12 || strlen($number) < 7) throw new Exception("Invalid phone number"); if(preg_match('/^\d+(\d-\d)?\d*(\d\s\d)?\d+$/', $number) === 1) return str_replace(array('-', ' '), '', $number); } echo ReformatPhoneNumber('012345');
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Exception: Invalid phone number in /in/H1hIc:5 Stack trace: #0 /in/H1hIc(10): ReformatPhoneNumber('012345') #1 {main} thrown in /in/H1hIc on line 5
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:
38.23 ms | 401 KiB | 8 Q