Home > Software engineering >  Inspect return value in PHP with Xdebug
Inspect return value in PHP with Xdebug

Time:11-17

Similarly to [1] and [2], I wonder if and how it is nowadays possible to inspect the return value of a method/function call in PHP with Xdebug and PhpStorm.

I find myself often to assign the value to a variable right before returning it (so it can be viewed) but I really would like a possibility to do this without changing the code, for several reasons.

[1] How do I debug last line of context?

[2] (not PHP but this is what I'm looking for) https://iosdevtips.co/post/118205216313/xcode-breakpoint-method-return-value

CodePudding user response:

I think you might need to wait for the next releases of PhpStorm and XDebug. XDebug 3.2 (expected for late Nov 2022) will include "Return value debugging", and PhpStorm 2022.3 will be able to show the data from this new function.

Sources:

  • Related