3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function path_components($path) { $components = array(); while ($path != "." && $path != "/") { array_unshift($components, basename($path)); $path = dirname($path); } if ($path == "/") array_unshift($components, "/"); return $components; } function path_relative_to($path, $rel) { $path_components = path_components($path); $copy = $path_components; $rel_components = path_components($rel); for($i = 0 ; $i < count($rel_components ; ++$i)) { if ($path_components[$i] == $rel[$i]) array_shift($copy); else break; } return $copy; } var_dump(path_relative_to("/a/b/c", "/"));
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.3.0 - 5.4.11
Parse error: syntax error, unexpected ';' in jAb9j on line 24
Process exited with code 255.