H I O X INDIA
FREE PHP Topics
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Directories 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)   Bookmarks :-)  
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

PHP Topics
Introduction
Common Header
Random Number
Type
Form Variables
Date and Time
PHP Mysql Functions
File Handling
Error Handling
DB Size
PHP Mail
String Tokens
Running PHP from JS
Array To JS
Array to PHP
Encryption
Ask Your Doubts
Feedback





Integer data type in PHP


Topic

How to define a Integer variable and assign value?



Explanation

The integer data type is used to specify a numeric value without a fractional component.

The range of integers in PHP is equivalent to the range of the long data type in C. On 32-bit platforms, integer values can range from -2,147,483,648 to +2,147,483,647. When you are declaring integer variable, you can declare as given below

integer $variable;

where integer denotes the type of the variable.

You can also declare variable without datatype, in such case PHP will try to determine type of variable based on the value hold by that variable. Below I have declared a variable without its type.

$variable =10;

Here the variable hold the integer value so it is of type integer.

If you want to get a type of a variable, you can use gettype() function.
Example:

print gettype($variable);

Above code will print type integer because integer(whole number) value is assigned to that variable. If you specify a number beyond the limits of the integer type then PHP automatically converts larger values to floating point numbers.




others


privacypolicy     licence     sitemap
(c) copyright, 2004 hioxindia.com