标签:php基础 自动 ber ble style rand _for 生成 数字
<?php //1.自动转换 $a = 5; $b = "5a"; $c = $a + $b; echo $c; echo "<br>"; $a = 5; $b = "5a"; $c = $a.$b; echo $c; echo "<br>"; //1.(数值变量/数字字符串)检测 $a = 5; $b = "5"; $c = "123"; echo is_numeric($a); echo "<br>"; echo is_numeric($b); echo "<br>"; //2. is_int() 和 is_float() is_double() //3.生成随机数 mt_rand() $num = mt_rand(); echo $num; echo "<br>"; $num1 = mt_rand(1, 100); echo $num1; echo "<br>"; //4.数字格式化 $num = 1234566776; echo number_format($num); echo "<br>"; $num1 = 223445.2334; echo number_format($num1,2); echo "<br>"; //5.数学函数、 $number1 = -555; echo abs($number1); ?>
标签:php基础 自动 ber ble style rand _for 生成 数字
原文地址:http://www.cnblogs.com/noper/p/6216438.html