I have a string
like http://domain.sf/app_local.php/foo/bar/33
.
The last characters are the id
of an element. Its length could be more than one, so I can not use:
substr($dynamicstring, -1);
In this case, it must be:
substr($dynamicstring, -2);
How can I get the characters after "/bar/" on the string
without depending on the length?
You can use explode(), like this:
$id = explode('/',$var);
And take the element where you had the id.