Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly extract get variables

I am still somewhat new to php and was wondering the best way to extract a $_GET variable from a url.

for example how would I capture it out of something like this:

http://www.blahblahblah.com/reset_password.php?token=3072420e7e32cbcf304da791537d757342cf5957

just want to get everything from the "token=etc..."

thanks in advance

like image 386
LightningWrist Avatar asked Nov 29 '22 04:11

LightningWrist


1 Answers

An easy way:

$token = isset($_GET['token']) ? $_GET['token'] : null;

If token is set it is assigned to $token, otherwise $token is null.

like image 192
Hamish Avatar answered Dec 04 '22 22:12

Hamish