Search code examples
phpstorm

How I see the result of a function in PhpStorm


I have PHP code like these:

$q = $conn->prepare("select * from worker");
$q->execute();

$result = $q->fetchAll();
echo json_encode($result);

How I can see the json result of the $result variable in PhpStorm?

BTW, I know how to add break point and stop at the line I want I just don't know how to read the value returned from json_encode.

enter image description here


Solution

  • Open menu -> Run -> Evaluate Expression (or press Alt-F8) and add json_encode($result) as the expression to be evaluated.

    Or add the expression into the Watches window using the green plus button visible in your screenshot.