----- 016-math.php -----
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 5 <title>数学函数测试</title> 6 </head> 7 <body> 8 <h3>数学函数测试</h3> 9 <pre> 10 <?php 11 echo "-2.7的绝对值:", abs(-2.7), "\n"; 12 echo "2.4取FLOOR:", floor(2.4), "\n"; 13 echo "2.4取ROUND:", round(2.4), "\n"; 14 echo "2.4取CEIL:", ceil(2.4), "\n"; 15 echo "1023换二进制:", decbin(1023), "\n"; 16 echo "1和0.9哪个大:", max(1, 0.9), "\n"; 17 echo "2的30次方:", pow(2, 30), "\n"; 18 echo "1到2随机数10次:\n"; 19 for($i=0; $i<10; $i++) 20 echo rand(1, 2), "\t\n"; 21 echo "取2的开方:", sqrt(2), "\n"; 22 ?> 23 </pre> 24 </body> 25 </html>