PHP Introductory Tutorial Math skills Summary _php Skills

Source: Internet
Author: User
Tags getting started with php php database rand

This example describes the math skills of the introductory PHP tutorial. Share to everyone for your reference, specific as follows:

demo1.php

<?php
//$a = ' 5 ';
$b = 7+ $a;
echo $b;
  $a = ' a ';
  $b = 7+ $a;
  echo $b;
? >

demo2.php

<?php
  $a = 10.0;
  Is_int--Detects whether the variable is an integer
  if (is_int ($a)) {
    echo ' passes ';
  } else{
    Echo ' do not pass ';
  }
? >

demo3.php

<?php
  $a = 10.0;
  Is_int--Detects whether the variable is an integer
  if (is_int ($a)) {
    echo ' passes ';
  } else{
    Echo ' do not pass ';
  }
? >

demo4.php

<?php
  //rand-produces a random integer
  //echo rand (0,10);
  echo Mt_rand (0,100);
  echo Getrandmax ()//MAX number 32767
  //echo mt_getrandmax ()//MAX 2147483647?>


demo5.php

<?php
//$i = 123456789.4454;
$b = Number_format ($i, 2);
echo $b;  123,456,789.45
  $i = 12378456.456789;
  $b = Number_format ($i, 2, ' # ', ' @ ');
  echo $b;//12@378@456#46
?>

demo6.php

<?php
//$a =-6;
Echo ABS ($a);//Absolute value
//$b = 5.66;
echo Floor ($b),//round to take the whole
//Echo ($b);/Rounded
  Echo min (1,23,456,87,45,7,54)//1 Find minimum value or minimum value in array
  echo Max (1,23,456,87,45,7,54);//456 the maximum or maximum value of
  echo Pi () in the array,//3.14159265359
  echo pow (2,6);//64
?>

More interested in PHP related content readers can view the site topics: "PHP Mathematical Arithmetic Skills Summary", "Basic PHP Grammar Primer", "PHP operation and operator Usage Summary", "PHP object-oriented Programming Program Introduction", "PHP Network Programming Skills Summary", "PHP string ( String) Usage summary, "Getting Started with Php+mysql database operations" and "Summary of common PHP database Operations Tips"

I hope this article will help you with the PHP program design.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.