Skip to content
Justice Tech School

Math Functions

abs, sqrt, pow, max, min, pi, round and random_int help with numbers.

Example
echo abs(-5), " ", sqrt(16), " ", pow(2, 8), " ", max(1, 9, 3), " ", round(pi(), 3), "\n";
echo random_int(5, 5);

Result

5 4 256 9 3.142
5

Exercise

Square root.

(16)

Quiz Test

Which gives a secure random int?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.