PHP Exponent operator (**) introduced in PHP 5.6

PHP has released its new version 5.6 couple of days before. In the new version a new exponent  operator has been introduced for the exponentiation operation. Till now exponentiation was carried out using a built-in function pow in PHP. From PHP 5.6 this can be carried using double airstrike (**) to execute exponentiation. The new exponent operator in php is a very handy way to write code than calling a function as required now.

Before using Exponent Operator (**) in PHP

If the new exponent operator (**) is used in PHP versions below 5.6, it will throw a parse error Parse error: syntax error, unexpected ‘*’. So make sure your PHP version is 5.6 before you start using  the new operator for exponentiation in PHP.

Leave a Reply