3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $snapshotUrl = 'dir1/dir2/dir3/dir4/filename.fileextension'; echo strrpos($snapshotUrl, '/'); echo PHP_EOL; //echo substr($file = substr($snapshotUrl, strrpos($snapshotUrl, '/', '-1') + 1), 0, strpos($file, '.')); echo substr($snapshotUrl, 0, strrpos($snapshotUrl, '/') + 1);
based on RbToV
Output for 5.6.0 - 7.3.0alpha1
19 dir1/dir2/dir3/dir4/