php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #64687 Implements __empty() and __equals()
Submitted: 2013-04-21 13:14 UTC Modified: -
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: lpu8er at gmail dot com Assigned:
Status: Open Package: *General Issues
PHP Version: 5.5.0beta3 OS:
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: lpu8er at gmail dot com
New email:
PHP Version: OS:

 

 [2013-04-21 13:14 UTC] lpu8er at gmail dot com
Description:
------------
For convenience, we should be able to use objects at any time, including into the language constructs.

Java implements .equals() in order to compare objects.
Such a request already exists, but in a single comment:
http://www.php.net/manual/en/language.oop5.object-comparison.php#85769

The basic/default behavior (fallback) for such a method would be same as actual.

The proto would be:
public function __equals(stdOject $comparisonObject)
and couldn't be called statically.

In the same way, having some __empty() method would be fine, which would act as empty() for the basic/default behavior.


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Aug 18 23:01:26 2019 UTC