Page 1 of 1

Debugging value returned by class function call

Posted: Sat Jul 29, 2006 7:53 am
by anjanesh
Im debugging one class and was using die($obj->varORmethod) to get the run-time value.

Code: Select all

include_once('cls.class.php');
$obj = new cls();
echo $obj->foo(); die(); # Works. Outputs correct value
but if I change the last line to die($obj->foo());, it returns blank.

$cls->foo() returns an integer.

How is this possible ?

Using PHP 5.1.4

Thanks

Posted: Sat Jul 29, 2006 8:06 am
by tecktalkcm0391
I am not 100% sure but I think its because it already killed the PHP Script. This might work:

Code: Select all

include_once('cls.class.php'); 
$obj = new cls(); 
$die = $obj->foo(); 
die($die);