3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = '//google.com/fgdgfg/rt'; if (filter_var($string, FILTER_VALIDATE_URL)) { return $string; } $string = trim($string); $string = str_replace(' ', '', $string); $string = iconv('utf-8', 'us-ascii//TRANSLIT', $string); if (!preg_match('/^https?:\/\//', $string)) { $string = 'http://' . $string; } if (!filter_var($string, FILTER_VALIDATE_URL)) { throw new Exception('Ссылка'); } echo $string;
Output for 7.0.0 - 7.0.5, 7.0.20 - 7.2.0
Fatal error: Uncaught Exception: Ссылка in /in/1uN6B:16 Stack trace: #0 {main} thrown in /in/1uN6B on line 16
Process exited with code 255.
Output for 7.0.6
Fatal error: Uncaught Error: Call to undefined function iconv() in /in/1uN6B:10 Stack trace: #0 {main} thrown in /in/1uN6B on line 10
Process exited with code 255.
Output for 5.3.20 - 5.5.34, 5.6.8 - 5.6.20, 5.6.28
Fatal error: Uncaught exception 'Exception' with message 'Ссылка' in /in/1uN6B:16 Stack trace: #0 {main} thrown in /in/1uN6B on line 16
Process exited with code 255.
Output for 5.5.35, 5.6.21
Fatal error: Call to undefined function iconv() in /in/1uN6B on line 10
Process exited with code 255.