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
39 lines (31 loc) · 1.06 KB
/
maths.php
File metadata and controls
39 lines (31 loc) · 1.06 KB
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
28
29
30
31
32
33
34
35
36
37
38
<?php
//Define a variable whose value is the result of the function that returns an absolute value
var_dump(abs(-4.2));
echo"<br><br>";
var_dump(abs(5));
echo"<br><br>";
var_dump(abs(-5));
echo"<br><br>";
//Define a variable whose value is the result of the function that returns a rounded value to the next highest integer.
echo ceil(4.3); // 5
echo"<br><br>";
echo ceil(9.999); // 10
echo"<br><br>";
echo ceil(-3.14);
echo"<br><br>";
//Define a variable whose value is the result of the function that returns the highest value of a series of values that are received by parameter.
echo max(2, 3, 1, 6, 7);
echo"<br><br>";
echo max(array(2, 4, 5));
echo"<br><br>";
//Define a variable whose value is the result of the function that returns the lowest value of a series of values that are received by parameter.
echo min(2, 3, 1, 6, 7);
echo"<br><br>";
echo min(array(2, 4, 5));
echo"<br><br>";
//Define a variable whose value is the result of the function that returns a random number
echo rand() . "\n";
echo rand() . "\n";
echo rand(5, 15);
echo"<br><br>";
?>