| Basic PHP Data Types | | Print | |
Page 1 of 4
Basic PHP Data Types
The first data type I'll introduce you to is the integer. The integer is the fundamental numeric data type in PHP and represents whole-number signed values up to a little over 2 billion. In practice, PHP will accept integer values using three mathematical bases: decimal (base 10), octal (base 8), and hexadecimal (base 16). In most situations, PHP scripts are written using decimal notation; however, in some situations octal or hexadecimal numbers make life easier.
Listing 1.4. Storing Integers in PHP
<?php
$my_int = 50; /* Standard Decimal Notation */
$my_int = O62; /* Same number, Octal Notation (starts with the letter O)*/
$my_int = 0x32; /* Hexadecimal Notation */
?>
When working with fractions, PHP represents the value using the floating-point data type. Floating-point numbers are defined as any number that contains a decimal fraction and that can be expressed in decimal or scientific notation.
This entry was posted on . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a comment.
Tags: Simple PHP, Pear, Easy PHP, PHP Tutorial, PHP MySQL, XSLT, Sap Tutorial, CSS Tutorial, XSL FO Java, SQL Tutorial.
| Users' Comments (0) |
|
No comment posted






