|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-09-04 20:31 UTC] geoffgedde at gmail dot com
Description: ------------ Many times I prefer the syntax and usage of Objects over Arrays, but creating objects quickly is awkward and not very readable to the entire Team. However, it would be simplified if we could use a function called object() like we do with array(). Sure we could typecast array with (object) but that could be confusing to other devs if they miss-read or typecast. Instead it would be better to do: $obj = object( 'name' => 'Some Name', 'id' => 123 ); echo $obj->name; object() is an unused function so why can't it be added in? PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 12:00:01 2025 UTC |
Thanks requinix, Yeah I do use the method: object([ 'name' => 'Some Name', 'id' => 123 ]) This is more of a "If object() is available why not use it?" question.