|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-09-14 13:04 UTC] stochnagara at hotmail dot com
Description:
------------
I think it will be very useful to modify stdClass constructor from __construct() to __construct ($fields = array()).
This will make stdClass easier to work with like arrays.
Reproduce code:
---------------
$array = array ('a' => 2, 'b' => 3);
$obj = new stdClass;
$obj->a = 2;
$obj->b = 3;
//Not supported
$obj = new stdClass (array ('a' => 2, 'b' => 3));
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 20:00:02 2025 UTC |
Then convert array to object this way: <?php $a = array('a'=>'b', 'foo'=> 'bar'); var_dump((object)$a); ?>