Jez
0
Q:

php new object

   $object = new stdClass();
   $object->property = 'Here we go';

   var_dump($object);
   /*
   outputs:

   object(stdClass)#2 (1) {
      ["property"]=>
      string(10) "Here we go"
    }
   */
1
$x = new stdClass();
1

By far the easiest and correct way to instantiate an empty generic php object that you can then modify for whatever purpose you choose:



<?php $genericObject = new stdClass(); ?>



I had the most difficult time finding this, hopefully it will help someone else!
0

New to Communities?

Join the community