Saigonns
Saigonns

Reputation: 45

Get URL code not the whole URL

my php function is

$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

Upvotes: 2

Views: 42

Answers (2)

V. Panait
V. Panait

Reputation: 71

You can use this:

$code = array_pop(explode('/', $exp3));
echo $code;

Upvotes: 0

ScaisEdge
ScaisEdge

Reputation: 133400

You can use explode and get the last

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

 echo $my_last;

Upvotes: 1

Related Questions