PHP menyediakan fungsi matematis lengkap seperti rand(10, 100) untuk menghasilkan angka acak antara 10 sampai 100.
PHP Math
Contoh Kode PHP Math:
<!DOCTYPE html>
<html>
<body style="font-family: sans-serif; padding: 20px;">
<h2>Fungsi Matematika PHP</h2>
<ul>
<li><code>min(0, 150, 30, 20, -8, -200)</code> -> <strong>-200</strong></li>
<li><code>sqrt(64)</code> -> <strong>8</strong></li>
<li><code>round(0.60)</code> -> <strong>1</strong></li>
<li><code>rand(1, 6)</code> -> <strong>Acak Angka Dadu</strong></li>
</ul>
</body>
</html>
Uji kode PHP dan amati simulasi output server pada panel pratinjau di atas.