0

I am using core php. i am trying to print the query string, both key and values. but the keys with space is getting converting into underscore.

this is my simple php code

<?php
print_r($_REQUEST);
?>

and the URL i am hitting - http://localhost/user.php?A%20String=wqe%20qwe

result - Array( [A_String] => wqe qwe)

In the result A String is converting into the A_String, value is showing the space correctly but key is not. Is there any solution to this since i have parameters with underscore also ?

  • 2
    _"Is there any solution to this"_ - probably no other than to get the original query string out of $_SERVER, and then parsing it yourself. (You won't be able to use built-in functionality like `parse_str` - because that would also replace the space with an underscore again.) – CBroe Apr 28 '23 at 07:17
  • If builtin parser doesn't match your needs, you'll have to [build your own](https://3v4l.org/EIubl#v8.2.5). – Álvaro González Apr 28 '23 at 07:42

0 Answers0