php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #26402 Incorrect example of class variables initializers
Submitted: 2003-11-25 07:27 UTC Modified: 2003-12-21 10:55 UTC
From: al at forest dot akadem dot ru Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.3 OS: Any
Private report: No CVE-ID: None
 [2003-11-25 07:27 UTC] al at forest dot akadem dot ru
Description:
------------
In chapter 13 "Classes and objects" there is an example of non-valid and valid initializers:
<?php
/* None of these will work in PHP 4. */
class Cart
{
    var $todays_date = date("Y-m-d");
    var $name = $firstname;
    var $owner = 'Fred ' . 'Jones';
    var $items = array("VCR", "TV");
}
...

Actually, the initializer of $items varaible works at least in PHP 4.3.3. It may also work in previous versions as I haven't found any news in ChangeLog related to it.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-21 10:55 UTC] et@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 [2020-02-07 06:12 UTC] phpdocbot@php.net
Automatic comment on behalf of et
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=d774042fc763fad5b802e9e7b49484b37856a2b6
Log: Fix Bug #26402
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 07:01:32 2025 UTC