niranjnn01 Posted February 17, 2009 Share Posted February 17, 2009 Hello, is there a way for us to see the contents of an object, just like we see contents of an array using print_r ? Rakesh Link to comment https://forums.phpfreaks.com/topic/145506-solved-a-simple-question-about-objects/ Share on other sites More sharing options...
allworknoplay Posted February 17, 2009 Share Posted February 17, 2009 Hello, is there a way for us to see the contents of an object, just like we see contents of an array using print_r ? Rakesh Yeah I think so, just use it like normal: print_r($object); Link to comment https://forums.phpfreaks.com/topic/145506-solved-a-simple-question-about-objects/#findComment-763935 Share on other sites More sharing options...
Philip Posted February 17, 2009 Share Posted February 17, 2009 <?php class test { public $var1; public $var2; function testlol($var) { $this->var1 = $var; $this->var2 = 'haha'; } } $myClass = new test; $myClass->testlol("hi"); print_r($myClass); ?> Will show: test Object ( [var1] => hi [var2] => haha) Link to comment https://forums.phpfreaks.com/topic/145506-solved-a-simple-question-about-objects/#findComment-763941 Share on other sites More sharing options...
niranjnn01 Posted February 17, 2009 Author Share Posted February 17, 2009 yes.. i see... Thank you guys.. Link to comment https://forums.phpfreaks.com/topic/145506-solved-a-simple-question-about-objects/#findComment-763943 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.