Integers and Floating-Point Numbers in PHP
By: Emiley J. Printer Friendly Format
Integers
Integers are whole numbers and are equivalent in range as your C compiler’s long value. On many common machines, such as Intel Pentiums, that means a 32-bit signed integer with a range between –2,147,483,648 to +2,147,483,647. Integers can be written in decimal, hexadecimal (prefixed with 0x), and octal notation (prefixed with 0), and can include +/- signs.
Some examples of integers include
240000
0xABCD
007
-100
Note: As integers are signed, the right shift operator in PHP always does a signed shift.
Floating-Point Numbers
Floating-point numbers (also known as real numbers) represent real numbers and are equivalent to your platform C compiler’s double data type. On common platforms, the data type size is 8 bytes and it has a range of approximately 2.2E–308 to 1.8E+308. Floating-point numbers include a decimal point and can include a +/- sign and an exponent value.
Examples of floating-point numbers include
3.14
+0.9e-2
-170000.5
54.6E42
Comment on this tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Subscribe to Tutorials
Related Tutorials
PHP code to write to a CSV file for Microsoft Applications
PHP code to write to a CSV file from MySQL query
PHP code to import from CSV file to MySQL
Password must include both numeric and alphabetic characters - Magento
Resume or Pause File Uploads in PHP
Multiple File Upload in PHP using IFRAME
Error: Length parameter must be greater than 0
PHP file upload with IIS on windows XP/2000 etc
PHP file upload prompts authentication for anonymous users
Exception in module wampmanager.exe at 000F15A0 in Windows 8
Count occurrences of a character in a String in PHP