1
2 <?php
3function add_number(&$value) {
4 $value += 5;
5}
6
7$add = 2;
8add_number($add);
9
10 echo $add;
11?>
1
2 <?php declare(strict_types=1); // strict requirement
3function sum(int $x,
4 int $y) {
5 $z = $x + $y;
6 return $z;
7}
8
9
10 echo "5 + 10 = " . sum(5, 10) . "<br>";
11echo "7 + 13 = " . sum(7, 13) . "<br>";
12echo "2 + 4 = " . sum(2, 4);
13?>
1
2 <?php declare(strict_types=1); // strict requirement
3function addNumbers(float
4 $a, float $b) : float {
5 return $a + $b;
6}
7echo addNumbers(1.2, 5.2);
8
9?>