The examples in this article describe the usage of PHP standard classes (stdclass). Share it with everyone for your reference, the details are as follows:
php has a built-in standard class (stdclass)
<?php $obj = new stdclass(); echo '<pre class="brush:php;toolbar:false">'; var_dump($obj); $obj->a = 1; $obj->b = 1; var_dump($obj);
The running results are as follows:
object(stdClass)[1] object(stdClass)[1] public 'a' => int 1 public 'b' => int 1
When using type conversion, the standard class is used
$arr = array('a'=>1); var_dump((object)$arr);
I hope this article will be helpful to everyone in PHP programming.
For more articles related to PHP standard class (stdclass) usage examples, please pay attention to the PHP Chinese website!