Answer the question
In order to leave comments, you need to log in
Why doesn't XDebug see what's in the variable at the breakpoint?
Why can't XDebug see what's in the variable on the breakpoint? You can view the contents of the array only if you continue the execution of the program one step ahead.
Breakpoint:
Jumped onto the trail. string
Answer the question
In order to leave comments, you need to log in
The point is that a breakpoint is a point that WILL be executed, not ALREADY executed. Those. when XDebug stops at a line
it means that the line WILL only be executed. Accordingly, since the variable $arr is not declared anywhere before this line, the variable does not exist at all before this line is executed. The variable is created during the execution of this line. UPD
If the question is why the variable does not exist before the line is executed,
then imagine a hypothetical situation
function TestFunction(){
if ($_REQUEST['some_key'] == 1)
return [1,2,3,4,5];
else if ($_REQUEST['some_key'] == 2)
return '12345';
else if ($_REQUEST['some_key'] == 3)
return 12345;
//и т.д.
else
return null;
}
$arr = TestFunction();
var_dump($arr);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question