Little helper: Difference between revisions
From Sunhill Framework Documentation
created page |
+cat |
||
Line 17: | Line 17: | ||
This function does the same as | This function does the same as | ||
(object)array('a'=>1,'b'=>'abc'); | (object)array('a'=>1,'b'=>'abc'); | ||
[[Category:Helpers]] |
Latest revision as of 10:37, 30 September 2024
makeStdClass()
This function takes an associative array and converts it into a StdClass object. Example:
<?php var_dump(makeStdClass(['a'=>1,'b'=>'abc']);
results in
object(stdClass)#1 (1) { ["a"]=> int 1, ["b"]=> string(3) "abc" }
This function does the same as
(object)array('a'=>1,'b'=>'abc');