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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

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: Tue May 21 05:01:31 2024 UTC