Improved Error Messages in PHP 5

by Rekha 2010-01-28 12:46:39

In PHP 4.4.7,if you run the following code,


< ?php
function test($arg) { echo "function executed"; }
test();
?>


You get the following message:

Warning: Missing argument 1 for test() in /usr/bin/- on line 2


The error message here is reported at the position of the definition of the function, but really the error was in how the function was called. The required parameter to test was not passed.

However, if you run the same code in PHP 5:

Warning: Missing argument 1 for test(), called in /Users/jeff/- on line 3 and defined in /users/username/- on line 2

Tagged in:

809
like
0
dislike
0
mail
flag

You must LOGIN to add comments