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 Quote 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); Quote 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) Quote 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.. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.