illustrate
1. In addition to giving fixed breakpoints in PHP code, we can also add breakpoints in the command line.
2. Remove the previous method breakpoint function. Then specify on the command line to add a breakpoint in the method.
Example
prompt> b testFunc#3 [Breakpoint #1 added at testFunc#3]
#3 What does this mean? In fact, it means that we add a breakpoint on line 3 inside the method body. In other words, we added a breakpoint at the $i += 3; line. The number of lines is calculated from the line where the method is defined and starts from 1. If this line number is not added, it starts directly from the line where the method is defined.
prompt> r [Breakpoint #0 resolved at testFunc#3 (opline 0x1050ef660)] [Breakpoint #0 resolved at testFunc#3 (opline 0x1050ef660)] [Breakpoint #0 resolved at testFunc#3 (opline 0x1050ef660)] [Breakpoint #0 resolved at testFunc#3 (opline 0x1050ef660)] [Breakpoint #0 in testFunc()#3 at /Users/zhangyue/MyDoc/blogpost/dev-blog/php/202006/source/PHPDebug interactive extension.php:13, hits: 1] >00013: $i += 3; 00014: echo "This is testFunc! i:" . $i, PHP_EOL; 00015: }
The above is the method of setting breakpoints in the PHP command line. After you learn it, please try the example operation as soon as possible.