|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #66900 Object initializers
Submitted: 2014-03-13 18:15 UTC Modified: 2017-09-21 08:37 UTC
From: eldmannen+php at gmail dot com Assigned:
Status: Suspended Package: Scripting Engine problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
26 - 3 = ?
Subscribe to this entry?

 [2014-03-13 18:15 UTC] eldmannen+php at gmail dot com
Object initializers provides a more convenient way of initializing public fields and properties of an object.

Test script:
class Person
    public $name;
    public $age;

$person = new Person {
    name = "John Doe",
    age = 39


Expected result:
Person Object
    [name] => John Doe
    [age] => 39

Actual result:
Parse error: syntax error, unexpected '{'


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-21 08:37 UTC]
-Status: Open +Status: Suspended
 [2017-09-21 08:37 UTC]
Thank you for your interest in PHP and for submitting a feature request. Please
be aware that due to the magnitude of change this request requires, it would be
necessary to discuss it on PHP Internals list ( as an
RFC. Please read the guide about creating RFCs here:
<>. If you haven't had experience with writing
RFCs before, it is advised to seek guidance on the Internals list
(<>) and/or solicit help from one of the
experienced developers. 

Please do not consider this comment as a negative view on the merits of your
proposal – every proposal which requires changes of certain magnitude, even the
very successful and widely supported ones, must be done through the RFC process.
This helps make the process predictable, transparent and accessible to all
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Sep 23 05:01:26 2019 UTC