3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function path_relative_to($path, $rel) { $rel_lent = strlen($rel); if (strncmp($path, $ref, strlen($rel)) == 0) { return substr($path, strlen($rel)); } else { return ""; } } var_dump(path_relative_to("a/b/c", "a"));
Output for 5.0.4 - 5.6.30, hhvm-3.10.1, 7.0.0 - 7.1.10
Notice: Undefined variable: ref in /in/KG2lZ on line 6 string(0) ""
Output for hhvm-3.11.1 - 3.17.3
Notice: Undefined variable: ref in /in/KG2lZ on line 6 Warning: strncmp() expects parameter 2 to be string, null given in /in/KG2lZ on line 6 string(4) "/b/c"
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: ref in /in/KG2lZ on line 6 string(0) ""