3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $roots = array('/www/dev/sites/www.fred-4.com', '/www/dev/sites/www.fred-4.com-master'); foreach ($roots as $root) { $key = substr($root, strpos($root, '.com'), 0, 1); echo $root . " -> " . $key . PHP_EOL; }
Output for 5.3.0 - 7.1.0
Warning: substr() expects at most 3 parameters, 4 given in /in/lSQXu on line 8 /www/dev/sites/www.fred-4.com -> Warning: substr() expects at most 3 parameters, 4 given in /in/lSQXu on line 8 /www/dev/sites/www.fred-4.com-master ->
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.2.17
Warning: Wrong parameter count for substr() in /in/lSQXu on line 8 /www/dev/sites/www.fred-4.com -> Warning: Wrong parameter count for substr() in /in/lSQXu on line 8 /www/dev/sites/www.fred-4.com-master ->
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Warning: Wrong parameter count for substr() in /in/lSQXu on line 8 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/lSQXu on line 9 /www/dev/sites/www.fred-4.com -> PHP_EOL Warning: Wrong parameter count for substr() in /in/lSQXu on line 8 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/lSQXu on line 9 /www/dev/sites/www.fred-4.com-master -> PHP_EOL