0

How is possible extract only the number after the last = symbol in a string like this:

/neuroscan/analysis/admin/listo_aoi_list.php?mastertable=listo_pages&masterkey1=11

the number could be 1,11,345,888888 etc, I would if possible get it into an int variable.

Thanks

2
  • 1
    you can get it by $_GET['masterkey1'] in your listo_aoi_list.php file Commented Aug 25, 2015 at 5:03
  • 1
    If this is url the you use $_GET['masterkey1'] Commented Aug 25, 2015 at 5:04

2 Answers 2

1

You can try this:

$url = $_SERVER['REQUEST_URI'];
$val = (explode("=",$url));
echo $val[1];

$val[1] to getting second value after explode text after "="

Sign up to request clarification or add additional context in comments.

Comments

1

Try

$url = $_SERVER['REQUEST_URI']; $val = (explode("=",$url)); end($val);

It will always return you the last value after "="

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.