|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49512 Not follow the Ooop's law
Submitted: 2009-09-09 12:44 UTC Modified: 2009-09-09 12:57 UTC
From: binay dot kumar at osvin dot biz Assigned:
Status: Not a bug Package: *Programming Data Structures
PHP Version: 5.2.10 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
24 - 9 = ?
Subscribe to this entry?

 [2009-09-09 12:44 UTC] binay dot kumar at osvin dot biz
class xyz
	public function getName($id)
		return $id;

## in the above class i can access the class xyz method by "::", however i have not created the instance of the class.

by the oop's law , we can access a method by this way,method defined as static method. its working fine in both case either create a object of the class or by "::" to access.
can please describe me the things because its not following the oop's law.

Binay Kumar


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-09 12:57 UTC]
Thank you for your bug report.

You should indeed use the static keyword if you want to call a method without creating an object instance. However, PHP allows it and generates an E_STRICT warning. This is meant to work like this, therefore this is not a bug.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 01:01:28 2024 UTC