Integers and Floating-Point Numbers in PHP

By: Emiley J.  

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




Archived Comments


Most Viewed Articles (in PHP )

Error: Length parameter must be greater than 0

Installing PHP with nginx-server under windows

Exception in module wampmanager.exe at 000F15A0 in Windows 8

.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

The new keyword and constructors in PHP

Perl's Encoding::FixLatin equivalent in PHP

Warning: session_start(): open .... failed - PHP error

PHP 5.1.4 INSTALLATION on Solaris 9 (Sparc)

Building PHP 5.x with Apache2 on SuSE Professional 9.1/9.2

Installing PHP 5.x with Apache 2.x on HP UX 11i and configuring PHP 5.x with Oracle 9i

Cannot load /usr/local/apache/libexec/libphp4.so into server: ld.so.1:......

Setting up PHP in Windows 2003 Server IIS7, and WinXP 64

error: "Service Unavailable" after installing PHP to a Windows XP x64 Pro

Function to force strict boolean values in PHP

Function to sort array by elements and count of element in PHP

Latest Articles (in PHP)

Comment on this tutorial