[ create a new paste ] login | about

Link: http://codepad.org/djyxK3B3    [ raw code | output | fork ]

PHP, pasted on Jun 21:
1
2
3
4
5
6
7
8
9
10
<?php
# https://stackoverflow.com/a/7395331/367456

$url = 'http://domain.com/artist/song/music-videos/song-title/9393903';

$path = parse_url($url, PHP_URL_PATH);
$pathFragments = explode('/', $path);
$end = end($pathFragments);

var_dump($end);


Output:
1
string(7) "9393903"


Create a new paste based on this one


Comments: