Online
 
Thursday, 20 November 2008
 
 

Basic PHP Data Types | Print |  E-Mail
 

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)

Comment an article
  Name
  E-mail
   Title
Available characters: 4000
 Notify me of follow-up comments
This image contains a scrambled text, it is using a combination of colors, font size, background, angle in order to disallow computer to automate reading. You will have to reproduce it to post on my homepage
Enter what you see:

No comment posted

Jumbo Coklat
 
Top! Top!