.. _php-newexponent: .. _**-for-exponent: ** For Exponent +++++++++++++++ The operator ``**`` calculates exponents, also known as power. Use it instead of the slower function `pow() `_. This operator was introduced in PHP 5.6. Be aware the the '-' operator has lower priority than the `** `_ operator : this leads to the following confusing `result `_. This is due to the parser that processes separately ``-`` and the following number. Since ``**`` has priority, the power operation happens first. Being an operator, ``**`` is faster than `pow() `_. This is a microoptimisation. .. code-block:: php See also `Arithmetic Operators `_. Connex PHP features ------------------- + `exponential `_ Suggestions ___________ * Use the ``**`` operator * For powers of 2, use the bitshift operators * For literal powers of 2, consider using the ``0xFFFFFFFFF`` syntax. Specs _____ +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Short name | Php/NewExponent | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Changed Behavior `, :ref:`Suggestions `, :ref:`php-cs-fixable ` | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 0.8.4 | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | PHP Version | With PHP 5.6 and more recent | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Severity | Minor | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Quick (30 mins) | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Examples | :ref:`case-traq-php-newexponent`, :ref:`case-teampass-php-newexponent` | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+