get string piece, before last needle
function, php, string
Solution
You can use
$str = "asd/fgh/jkl/123";
echo substr($str, 0,strrpos($str, '/'));
Output
asd/fgh/jkl
Problem
Given ``` $str = "asd/fgh/jkl/123 ``` If we want to get string piece after last slash , we can use function `strrchr()` right? In php not function, to get string piece, before last slah, that is `asd/fgh/jkl` ? I know this can make via regex or other way, I am asking about internal function?