Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. I check, compile and run every program. Contact me at: aviboots(AT)netvision.net.il

Hostgator - Save 50% Off Your New Optimized WordPress Hosting With Coupon: WDA50

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Dedicated Hosting Superb Internet

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

getflywheel wordpress hosting


Distribute your Resume to 500+ Job Boards & Recruiters


6,580 questions

9,399 answers

573 users

How to output an object in PHP

4 Answers

0 votes
$object = new stdClass();
$object->text = 'php';
$object->version = '7.2';

print_r($object);


/*
run: 
 
stdClass Object ( [text] => php [version] => 7.2 )
 
*/

 




answered Sep 2 by avibootz
0 votes
$object = new stdClass();
$object->text = 'php';
$object->version = '7.2';

var_dump($object);


/*
run: 
 
object(stdClass)#1 (2) { ["text"]=> string(3) "php" ["version"]=> string(3) "7.2" }
 
*/

 




answered Sep 2 by avibootz
0 votes
function print_o($o)
{
    echo '<pre>';
    print_r($o);
    echo  '</pre>';
}

$object = new stdClass();
$object->text = 'php';
$object->version = '7.2';

print_o($object);


/*
run: 
 
stdClass Object
(
    [text] => php
    [version] => 7.2
)
 
*/

 




answered Sep 2 by avibootz
0 votes
$object = new stdClass();
$object->text = 'php';
$object->version = '7.2';

var_export($object);


/*
run: 
 
stdClass::__set_state(array( 'text' => 'php', 'version' => '7.2', ))
 
*/

 




answered Sep 2 by avibootz
...