-
-
- Small example of php mathematical function - bbs.it-home.org
- < ;body>
- echo abs(-1);//Get the absolute value function
- echo "
########ceil, floor function###### echo ceil(1);//Get the smallest integer greater than the parameter - echo ceil(-1.1);
- echo "
";
- echo floor(1.1);//Get the largest integer less than the parameter
- echo floor(-1.1);
echo " ########max function###### ";
- echo max( 1,2);//Take the maximum value of 1 and 2
- echo "
";
- $arr=array(1,2,3,4,5,7,6);
- echo max($arr );//Get the maximum value in the integer array
echo " ########pow function###### ";
- echo pow(5,2);//Output the value of 5 raised to the power of 2
echo " ########round function##### # ";
- echo round(1.511);//Rounding function
echo " ########rand function###### ";
- for($i=0;$i<1000;$i++){
- $temp=rand(0,9);//Take an integer value between 0 and 9, you can take it up to , the value of the lower limit
- /*
- if($temp==0)
- {
- echo "The value of the lower limit can be obtained";
- break;
- }
- */
- if($temp==9)
- {
- echo "The value that can get the upper limit";
- break;
- }
- }
?>
|