3v4l.org

run code in 300+ PHP versions simultaneously
<?php $chapter_full_path = "/test/eeee/last/"; $chapter_path_name = "last"; $chapter_path_name_length=strlen($chapter_path_name); $oldParentFullPathLength = strlen($chapter_full_path) - $chapter_path_name_length; $oldParentFullPath=substr($chapter_full_path,0,$oldParentFullPathLength-1); echo $oldParentFullPath;

preferences:
46.37 ms | 402 KiB | 5 Q