php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #52442 Static Keyword in PHP manual: Example has a bug
Submitted: 2010-07-26 02:50 UTC Modified: 2010-07-26 12:52 UTC
From: miss_shah00 at hotmail dot com Assigned:
Status: Not a bug Package: Website problem
PHP Version: 5.2.14 OS: Windows Vista Home Premium
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: miss_shah00 at hotmail dot com
New email:
PHP Version: OS:

 

 [2010-07-26 02:50 UTC] miss_shah00 at hotmail dot com
Description:
------------
PHP Manual at php.net, Language Reference->Classes and Objects->Static Keywords
http://www.php.net/manual/en/language.oop5.static.php

One of the statements in Example 1: Static Property Example

print $foo::$my_static . "\n";

does not compile because an instantiated object of a class cannot access static property. Therefore this example has an error.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-26 12:52 UTC] bjori@php.net
-Status: Open +Status: Bogus
 [2010-07-26 12:52 UTC] bjori@php.net
$ php -r 'class Foo { public static $prop = "value"; } $o = new Foo; 
var_dump($o::$prop);'
string(5) "value"


Works fine for me...
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 10:00:01 2026 UTC