php object creation code example
Example 1: php create object
$x = (object) [
'a' => 'test',
'b' => 'test2',
'c' => 'test3'
];
var_dump($x);
Example 2: make a object php
$object = new stdClass();
$object->property = 'Here we go';
var_dump($object);
Example 3: php new object
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!
Example 4: object php
$object = (object) [
'propertyOne' => 'foo',
'propertyTwo' => 42,
];
Example 5: php object
$obj = [
"example1" => 1,
"example2" => "two",
"example3" => [
"example4": true
]
]