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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 18:01:33 2024 UTC