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') -1, 1); echo $root . " -> " . $key . PHP_EOL; }
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
/www/dev/sites/www.fred-4.com -> 4 /www/dev/sites/www.fred-4.com-master -> 4
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/3UCco on line 9 /www/dev/sites/www.fred-4.com -> 4PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/3UCco on line 9 /www/dev/sites/www.fred-4.com-master -> 4PHP_EOL