3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function foo($path) { if ($path && $path[0] = '/') { $path = substr($path, 1); } $url = 'http://' . 'www.example.com/' . $url; echo $url; return $url; } foo('/abc'); foo('abc'); foo('/'); foo('');
Output for 5.0.4 - 7.2.0
Notice: Undefined variable: url in /in/3JCRD on line 6 http://www.example.com/ Notice: Undefined variable: url in /in/3JCRD on line 6 http://www.example.com/ Notice: Undefined variable: url in /in/3JCRD on line 6 http://www.example.com/ Notice: Undefined variable: url in /in/3JCRD on line 6 http://www.example.com/
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: url in /in/3JCRD on line 6 http://www.example.com/ Notice: Undefined variable: url in /in/3JCRD on line 6 http://www.example.com/ Notice: Undefined variable: url in /in/3JCRD on line 6 http://www.example.com/ Notice: Undefined variable: url in /in/3JCRD on line 6 http://www.example.com/