|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #66022 operator overloading bundle with future PHP versions?
Submitted: 2013-11-02 23:33 UTC Modified: 2017-10-24 23:03 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: worldoffame at hotmail dot com Assigned:
Status: Suspended Package: operator (PECL)
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-11-02 23:33 UTC] worldoffame at hotmail dot com
Its interesting that PHP has had operator overloading in PECL for such a long time, but never implemented with PHP core. 

Come to think about it, C# has operator overloading, Python has operator overloading, Ruby has operator overloading too. The only major programming language that can be used for server side programming without operator overloading is, Java! I thought PHP internals dont want PHP to behave/look like Java? 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-11-07 03:43 UTC] phpmpan at mpan dot pl
-> and paamayim nekudotayim are supported for years using __get and friends.
`isset` and `empty` for not much less.
[] is supported with `ArrayAccess`.

= operator is not re-implementable for reference-only languages, because it doesn't refer to an object.

Comparison and large part of arithmetic operators are currently¹ not implementable in languages that are not strongly typed².

What can be added is:
 - unary + (have you ever used this one?) and unary -
 - / and %, but use cases are quite limited, especially in case of a WWW-centered language.
 - << and >>, with even more limited use cases
 - || and &&, but it could only be a couriosity.

¹ In theory they're implementable, but calls are prohibitely expensive. Beybe in future this will change.
² Neither Python nor PECL/operator really work. They just give illusion of having operators, but the solution is inherently broken.
 [2017-04-01 21:00 UTC]
-Package: operator +Package: *General Issues
 [2017-04-01 21:03 UTC]
-Package: *General Issues +Package: operator
 [2017-04-01 21:03 UTC]
I got confused...
 [2017-10-24 23:03 UTC]
-Status: Open +Status: Suspended
 [2017-10-24 23:03 UTC]
The operator PECL package have not had a release for 4 years and development activity seems to have ceased, if a new maintainer picks up this package, then this report should be re-opened
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 19:01:34 2024 UTC