3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dir = array(); $dir[] = '/dir/dva'; $dir[] = '//dir\dva'; $dir[] = '\dir\dva'; $dir[] = '\\\\dir\dva'; $dir[] = '\/dir\dva'; $dir[] = '/\dir\dva'; foreach ($dir as $value) { echo ltrim($value, '/') . "\n"; echo ltrim($value, '\\') . "\n"; echo ltrim($value, '\/') . "\n"; echo ltrim($value, '/\\') . "\n"; }
Output for 4.3.0 - 7.1.0
dir/dva /dir/dva dir/dva dir/dva dir\dva //dir\dva dir\dva dir\dva \dir\dva dir\dva dir\dva dir\dva \\dir\dva dir\dva dir\dva dir\dva \/dir\dva /dir\dva dir\dva dir\dva \dir\dva /\dir\dva dir\dva dir\dva