I was simply wondering what would be the simplest and most efficient way of extracting a certain part of a dynamic string in PHP?
Per example, in this string:
<
Try parse_url over regex:
$segments = explode('/', parse_url($url, PHP_URL_PATH));
$segments will be an array containing all segments of the path info, e.g.
Array
(
[0] =>
[1] => video
[2] => xclep1_school-gyrls-something-like-a-party_music
)
So you can do
echo $segments[2];
and get
`xclep1_school-gyrls-something-like-a-party_music`