result of the expression in php

what is the result of the following expression print 5**2; also explain the concept


2 Answers
1-2 of  2
2 Answers
  • Expressions are the most important building blocks of PHP. In PHP, almost anything you write is an expression. The simplest yet most accurate way to define an expression is "anything that has a value".
    ** is an arithmetic operator. It is used for Exponentiation.It gives Result of raising one variable to the other varibale's power So if we want nth power of any number for that this operator is used.
    For example result of $x ** $y is raising $x to the $y'th power and this operator is introduced in PHP 5.6.
    Now 5**2  = (base = 5 & exponent = 2).
    5**2 = 25.

  • 5**2 is nothig but 5 square.in python ** is used for squaring.x**y means x^y.so by this concept the answer is 25.since 5^2 is 25.i think u understand it.

PHP

Didn't get the answer.
Contact people of Talent-PHP directly by clicking here