I leave you this function that was shared in the contributions of users of the PHP Manual , in the part relative to strtok
.
I think it comes as a glove for what you need:
function subtok($string,$chr,$pos,$len = NULL) {
return implode($chr,array_slice(explode($chr,$string),$pos,$len));
}
To use it in this particular case, it would be like this:
echo subtok($path,'/',2) ;
That is, you pass the route to it, tell it to use the /
separator and extract the information from the second separator.
The result would be:
Imagenes/Wallpaper/.../...
The advantage is that if you need other types of extractions, by another separator, or change the position you want to extract, you only have to change the parameters that you pass to the function.
For example:
echo subtok($path,'/',1) ;
Would give you as a result:
email_usuario/Imagenes/Wallpaper/.../...
Here you have a DEMO complete, and more details and examples of the function. I hope it serves you.