LuboEM LuboEM - 1 month ago 7
PHP Question

Get URL code not the whole URL

my php function is

<?php $exp3 = $_GET["url"];
echo $exp3;


This function gets me this link for example http://www.streamuj.tv/video/687aa15fe046f21cc1e3

What do I need is to transform this function to get just the code of the url. In this case its 687aa15fe046f21cc1e3.

Can you please help? Thank you

Answer

You can use explode and get the last

  $myArray= explode('/',$exp3 );
  $my_Last = end($myArray);

 echo $my_last;