|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #13756 exponential ** operator
Submitted: 2001-10-19 10:36 UTC Modified: 2013-02-28 21:19 UTC
From: Assigned: mike (profile)
Status: Closed Package: *General Issues
PHP Version: 4.0.6 OS: n/a
Private report: No CVE-ID: None
 [2001-10-19 10:36 UTC]
It would be nice to have an exponential operator. ** would be a logical choice, just like in C.

echo 2**3; // prints 8

I know we have pow(), but an operator for this would be nice...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-19 11:24 UTC]
** is Pascal, not C
 [2001-10-19 18:51 UTC]
I proposed that earlier (along with ^^) [ZendEnginge ML, june 27th & july 3rd].

Anyway, I think it should be added, there is simply no power operator now, and pow() is both a bit bugly and overloaded (both ^^ and ** at the same time).
 [2002-04-27 16:17 UTC]
not going to happen. just suck it up and use pow().
 [2012-07-08 23:31 UTC] hello at wesalvaro dot com
le why not?
 [2013-02-28 11:17 UTC] tom at r dot je
Indeed! Seems very despotic just to say "No. Deal with it" with no further 
discussion or explanation why.
 [2013-02-28 17:08 UTC]
@tom Exponentiation is an operation that is used too little (in PHP) to warrant adding an extra operator for it. Doing a random guess, I'd think it's used even less than the bitwise operators (and those are used quite rarely in PHP...)
 [2013-02-28 17:08 UTC]
-Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: nikic
 [2013-02-28 21:19 UTC]
-Assigned To: nikic +Assigned To: mike
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Feb 26 19:01:29 2024 UTC