PHP Debugging, $_SERVER Not all superglobals are shown in debugger

197 Views Asked by At

I was using a debugger in VScode: called PHP Debug 1.13.0. And XDebug installed on PC. When I open superglobals I don't see many of them which are actually exists and printable like "$_SERVER['REQUEST_METHOD']". Why are not all of them mentioned in debugger?

enter image description here

enter image description here

1

There are 1 best solutions below

3
Dennis Kozevnikoff On

The best way to debug PHP code (assuming you do not have a configured debugger, or if your debugger is not working properly) is with var_dump(). In your case, something like:

var_dump($_SERVER['method_name']);

Also, you can set up a breakpoint that will terminate program execution with die(), AND give you all the variable info that you need:

die(var_dump($_SERVER['method_name']));