Author Topic: Debug PHP  (Read 484 times)

0 Members and 1 Guest are viewing this topic.

M. O.

  • Administrator
  • MasstKer
  • *
  • Posts: 9184
    • View Profile
    • http://www.tkc-community.net
Debug PHP
« on: October 04, 2009, 09:48:48 pm »
Does anybody know any good php-debugging techniques?
Heckling is an art, and game hacking a science.

[TKC]Anothercheater

  • Heckler Apprentice
  • ****
  • Posts: 1349
    • View Profile
Re: Debug PHP
« Reply #1 on: October 06, 2009, 12:29:20 pm »
Code: [Select]
function vardump($array) {
print("\n<pre>");
var_dump($array);
print("</pre>\n");
}

function printArray($array) {
print("\n<pre>");
print_r($array);
print("</pre>\n");
}
use the first function for objects/functions/vars and the second for arrays.

use
Code: [Select]
die('wtf is going on'); to stop a php process at a certain point (its like a "haltpoint" without continue) - its equal to
Code: [Select]
exit(0); just without the 'wtf is going on' printed out to the browser after the call of die().

most important setting:
Code: [Select]
error_reporting(E_ALL); at the beginning or in the first include (config) file of your project.
« Last Edit: October 06, 2009, 02:36:19 pm by [TKC]Anothercheater »

M. O.

  • Administrator
  • MasstKer
  • *
  • Posts: 9184
    • View Profile
    • http://www.tkc-community.net
Re: Debug PHP
« Reply #2 on: October 06, 2009, 05:59:03 pm »
Ok thanks.  :icon_thumbsup
Heckling is an art, and game hacking a science.