dexter dexter - 1 year ago 87
PHP Question

how to get last id number from url using php

i want get last id from url,
i have url from text file like this

how to get output

i have this code

$file = fopen("file.txt", "r");
$line = fgets($file);
# do same stuff with the $line

$str = ($line);

if(preg_replace("/.+?\.*/", "$str", $m)){
echo $m[1] .'<br>' ;

but not work

Answer Source

Try this:

$input_value = '';
$last = explode('=', strstr($input_value, '&tid'));
echo $last[1];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download