I want to get filename without any $_GET variable values from a URL in php?
$_GET
My URL is http://learner.com/learningphp.php?lid=1348
http://learner.com/learningphp.php?lid=1348
I
An other way to get only the filename without querystring is by using parse_url and basename functions :
$parts = parse_url("http://example.com/foo/bar/baz/file.php?a=b&c=d"); $filename = basename($parts["path"]); // this will return 'file.php'