Exponentiation Precedence in PHP
The exponentiation operation has precedence over multiplication and division. In the following example, exponentiation will be performed first, and then multiplication:
php<?php
echo 2 * 2 ** 3;
?>
Задание 1
Without running the code, determine what will be displayed on the screen:
php<?php
$a = 3 * 2 ** 3;
echo $a;
?>
Задание 2
Without running the code, determine what will be displayed on the screen:
php<?php
$a = (3 * 2) ** 3;
echo $a;
?>
Задание 3
Without running the code, determine what will be displayed on the screen:
php<?php
$a = 3 * 2 ** (3 + 1);
echo $a;
?>
Задание 4
Without running the code, determine what will be displayed on the screen:
php<?php
$a = 2 ** 3 * 3;
echo $a;
?>
Задание 5
Without running the code, determine what will be displayed on the screen:
php<?php
$a = 3 * 2 ** 3 * 3;
echo $a;
?>