forked from assembler-institute/php-basics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaths.php
More file actions
27 lines (20 loc) · 726 Bytes
/
maths.php
File metadata and controls
27 lines (20 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
echo("<h1>math functions on PHP</h1>");
$num1 = -77.89;
echo("<h2>Absolute value</h2>");
echo("<p>The absolute value of $num1 is " .abs($num1). "</p>");
echo("<hr>");
$num2 = 7.5;
echo("<h2>Rounded value to the next highest integer</h2>");
echo("<p>The rounded value of $num2 is " .round($num2). "</p>");
echo("<hr>");
$numbersArr = array (3,2,7,9);
echo("<h2>The highest value of an array</h2>");
echo("<p>The highest value of an array (3,2,7,9) is " .max($numbersArr). "</p>");
echo("<hr>");
echo("<h2>The lowest value of an array</h2>");
echo("<p>The lowest value of an array (3,2,7,9) is " .min($numbersArr). "</p>");
echo("<hr>");
echo("<h2>Random number</h2>");
echo("<p>Rando number: " .rand(). "</p>");
?>