Question: ```
http://localhost/mc/site-01-up/index.php?c=lorem-ipsum

$address = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$stack = explode('/', $_SERVER["REQUEST_URI"]);
$file = array_pop($stack);
echo $file;

```

result - `index.php?c=lorem-ipsum`

How to get just file name (`index.php`) without `$_GET` variable, using `array_pop` if possible?

Answer: 
One way of doing it would be to simply get the `basename()` of the file and then strip-out all the Query Part using regex or better still simply do pass the `$_SERVER['PHP_SELF']` result to the `basename()` Function. Both will yield the same result though the 2nd approach seems a little more intuitive. 

```
<?php

    $fileName  = preg_replace("#\?.*$#", "", basename("http://localhost/mc/site-01-up/index.php?c=lorem-ipsum"));
    echo $fileName;  // DISPLAYS: index.php

    // OR SHORTER AND SIMPLER:
    $fileName   = basename($_SERVER['PHP_SELF']);
    echo $fileName;  // DISPLAYS: index.php

```
If you are trying to use the GET method without variable name, another option would be using the $\_SERVER["QUERY\_STRING"]

<http://something.com/index.php?=somestring>

$\_SERVER["QUERY\_STRING"] would return "somestring"