How To Debug Execution Path in PHP…Equivalent of printStackTrace() in Java ����� ����� ���� ������� �� ��. ���. ��… �� ����� printstacktrace ((�� ����
While programming in PHP often you will find that a simple echo or log statement is not sufficient. ��. ���. �� ����� ������� �� ���� �� ������� ���� �� ���� ��� �� ��� ������ �� ����. You have found out where a problem is happening but you have no clue why it is executing that code in the first place. ��� ������ ���� ����� ���� ���� �� ���� ���� ���� ����� ��� ��� �� ����� ������� �� ������ �����. This is where execution path comes in handy. ���� �� ������ ��� ������� ����� �� ������ ����� ������. With a simple call you can display the whole execution path of the code so far, every function that was executed, in which file and in which line number. �� ���� ����� ����� ��� ���� ���� ������� �� ����� ��� ���� � �� �� ����� ���� � �� ����� ����� ���� ��� ����. Isn't that handy? ���� ��� ���Ͽ
Use debug_print_backtrace() to print the full execution path of the code upto that point. ������� debug_print_backtrace () ������ ���� ������� ������ ������� upto ��� ������. You can also use debug_backtrace() which returns an associative array with the following data: ����� ���� ������� debug_backtrace () ���� ������� ������ �� ������ �� �������� ������� :
Possible returned elements from debug_backtrace() ��� ���� �� ������� debug_backtrace ()
| Name ��� | Type ��� | Description ����� |
|---|---|---|
| function ������� | string ����� | The current function name. ��� ������� �������. See also ���� ���� |
| line ���� | integer ��� ���� | The current line number. ���� ������ ����. See also ���� ���� __LINE__. __line__. |
| file ��� | string ����� | The current file name. ��� ����� ������. See also ���� ���� __FILE__. __file__. |
| class ������ | string ����� | The current class name. ��� ������ �������. See also ���� ���� |
| type ��� | string ����� | The current call type. ������ ����� ������. If a method call, "->" is returned. ��� ��� ����� ������ � "-->" �� ���. If a static ��� ���� ����� method call, "::" is returned. ����� ������ � ": :" �� ���. If a function call, nothing is returned. ��� ���� ����� ������ � ���� ���� �� �� ���. |
| args | array ������ | If inside a function, this lists the functions arguments. ��� ��� ���� ����� � ����� ���� ��� �����. If ��� |
Filed under ������ ������ Headline News ��� ������� , � How To ��� , � Java Software ������ ���� , � Open Source Software ����� ������ ������� , � PHP ��. ���. �� , � Programming ������� , � Tech Note ������ ����� , � Web ���� | |
| |
RSS 2.0 �� �� �� 2�0 | |
Trackback this Article | ��� ������ |
Email this Article ���� ��� ������
You may also like to read ������ ���� �� ���� |



































