php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35738 how to declare a non static method
Submitted: 2005-12-20 05:24 UTC Modified: 2005-12-20 09:01 UTC
From: sqchen at citiz dot net Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.1.1 OS: redhat 7.3
Private report: No CVE-ID: None
 [2005-12-20 05:24 UTC] sqchen at citiz dot net
Description:
------------
as php manual says:
http://www.php.net/manual/en/language.oop5.static.php

if a method is declared as just public, it will be no static method, right? it not, how to declared a no static method

Reproduce code:
---------------
<?php
class A{
public function foo(){   //no static method?
echo "[foo]\n";}
}

public static function static_foo(){//static method?
echo "[static_foo]";}
}
A::foo();  //[foo]
A::static_foo(); //[static_foo]		
?>


Expected result:
----------------
warning:
[static_foo]

Actual result:
--------------
[foo]
[static_foo]

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-20 08:25 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

.
 [2005-12-20 09:01 UTC] sqchen at citiz dot net
sorry , my code is not clearly:
and here is the right code:

<?php
class A{
    public function foo()
    {   
    echo "[foo]\n";
    }

     public static function static_foo()
     {
     echo "[static_foo]";
     }
}
A::foo();  
A::static_foo(); 		
?>

expected result: warning
                 [static_foo]
actual result:   [foo]
                 [static_foo]
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 09:01:28 2024 UTC