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/' . $path; echo $url; return $url; } foo('/abc'); foo('abc'); foo('/'); foo('');
based on 3JCRD
Output for 4.3.3 - 7.2.0
http://www.example.com/abchttp://www.example.com/bchttp://www.example.com/http://www.example.com/
Output for 4.3.0 - 4.3.2
http://www.example.com//abchttp://www.example.com//bchttp://www.example.com//http://www.example.com/