The simplest way of debugging is adding echo or die calls to your code.
Pros
- Easy to add to your code
- Fast way to check simple issues
Cons
- No environment information
- Complex issues need lots of debugging code
- No type information for echoed variables
- Hard to display complete objects/arrays
<?php
function foo() {
echo "Foo has been called!<br />";
}
function bar() {
die("Bar has been called!<br />");
}
for ($i = 0; $i < 3; $i++)
foo();
for ($i = 0; $i < 3; $i++)
bar();
?>
Output
Foo has been called!
Foo has been called!
Foo has been called!
Bar has been called!
Foo has been called!
Foo has been called!
Bar has been called!