Lecture 26 - PHP (Numbers)
Lecture 26 - PHP (Numbers)
Engineering
Lecture 26
Numbers in PHP
Everywhere
Time, Date, Cost, Contants
In PHP: Integers and floating-point numbers
Automatically converts from strings to numbers and back
Introduction 1+"1" is 2.
2.2e–308 - 1.8e308
BCMath and GMP Liberaries
Checking
Whether a
Variable
Contains a
Valid Number
5,100?
Use str_replace()
Checking
Whether a
Variable
Contains a
Valid Number is_float() ; is_double() ; is_int()
Comparing
Floating-Point
Numbers
$number = round(2.4)
$number = ceil(2.4);
Calculating
Exponents
Formatting
Numbers
Printing
Correct Plurals
Calculating
Trigonometric
Functions
Handling Very
Large or Very
Small
Numbers
Questions?