Get Last Part of URL PHP
The absolute simplest way to accomplish this, is with basename() echo basename(‘http://domain.com/artist/song/music-videos/song-title/9393903’); Which will print 9393903 Of course, if there is a query string at the end it will be included in the returned value, in which case the accepted answer is a better solution.