3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function formatPhoneNumber(string $phonenumber) { $phonenumber = str_replace([' ', '-', '.', '(', ')'], '', $phonenumber); if (strpos($phonenumber, '+') === 0) { return $phonenumber; } if (strlen($phonenumber) === 10 && strpos($phonenumber, '06') === 0) { return '+31' . ltrim($phonenumber, '0'); } return $phonenumber; } echo formatPhoneNumber('0031 (0) 6 123 45 678');
Output for hhvm-3.15.4, 7.0.0 - 7.2.6
00310612345678
Output for 5.6.0 - 5.6.30
Catchable fatal error: Argument 1 passed to formatPhoneNumber() must be an instance of string, string given, called in /in/TXFYX on line 17 and defined in /in/TXFYX on line 3
Process exited with code 255.