Req #62044 [Com]: Short object syntax request

From: Date: Mon, 21 May 2012 17:47:55 +0000
Subject: Req #62044 [Com]: Short object syntax request
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-170644@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62044&edit=1 ID: 62044 Comment by: duke at ejoom dot com Reported by: pravdin at vl dot ru Summary: Short object syntax request Status: Open Type: Feature/Change Request Package: Scripting Engine problem PHP Version: 5.4.3 Block user comment: N Private report: N New Comment: It will be nice to see this feature. We should have more friendly syntax. Previous Comments: ------------------------------------------------------------------------ [2012-05-16 02:56:45] pravdin at vl dot ru Description: ------------ Thanks for short arrays syntax! :) Now it's a time to create short object syntax for simple creatation of anonymous objects with custom fields. The current shortest way is: $obj = (object)['field1' => 'value1', 'field2' => 'value2']; Think it isn't beautiful :) I suggest the following syntax similar to JavaScript (which is very handly): $obj = {{field1: 'value1', field2: 'value2'}}; or, if it possible, the same as JavaScript: $obj = {field1: 'value1', field2: 'value2'}; ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62044&edit=1

« previous php.bugs (#170644) next »