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'); function MaxArray(array $arr) { $max = 0; foreach($arr as $element) { if(is_array($element)) $max = MaxArray($element) > $max ? MaxArray($element) : $max; $max = $element > $max ? $element : $max; } return $max; } $arr = array(array(141,151,161), 2, 3, array(101, 202, array(303,404))); echo MaxArray($arr);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Exception: Invalid phone number in /in/JPhYL:5 Stack trace: #0 /in/JPhYL(10): ReformatPhoneNumber('012345') #1 {main} thrown in /in/JPhYL 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:
37.42 ms | 401 KiB | 8 Q