php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #44451 static method ?
Submitted: 2008-03-17 02:16 UTC Modified: 2008-03-17 10:56 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: sskaje at gmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5.2.5 OS: Windows XP Professional sp2
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: sskaje at gmail dot com
New email:
PHP Version: OS:

 

 [2008-03-17 02:16 UTC] sskaje at gmail dot com
Description:
------------
Read the example shown on php manual, from the 'Static Keyword' part of '19. Classes and Objects (PHP 5)'.

there's an example at the bottom of that page which:


Example 19.16. Static method example

[code]
<?php
class Foo {
    public static function aStaticMethod() {
        // ...
    }
}

Foo::aStaticMethod();
$classname = 'Foo';
$classname::aStaticMethod();
?> 

[/code]

i tried it, but there is a parse error reported:

Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in H:\server\wwwroot\test\static.php on line 10

then i tried the 

Example 19.15. Static member example

but i got a same error

i wanna know if its' a bug or just a coming up feature ?

Reproduce code:
---------------
<?php
class Foo {
    public static function aStaticMethod() {
        echo 'haha, static method';
    }
}

Foo::aStaticMethod();
$classname = 'Foo';
$classname::aStaticMethod();
?> 


Expected result:
----------------
haha, static method

Actual result:
--------------
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in H:\server\wwwroot\test\static.php on line 10


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-17 02:18 UTC] sskaje at gmail dot com
Expected result should be:
----------------
haha, static methodhaha, static method
 [2008-03-17 05:27 UTC] nulubo200 at yahoo dot com
The example you are referring to is located at: http://docs.php.net/manual/en/language.oop5.static.php

There is a comment in the example that says it is available in php 5.3.0. So to answer your question...it is a feature to look forward to. I think this bug can be closed.
 [2008-03-17 10:56 UTC] felipe@php.net
Exactly, as of 5.3.0.

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 15:01:29 2024 UTC