phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


PHP Basic: Integer Data Type

Tag: data type, integer   Category: PHP Basic
post: 01 Mar 2008 read: 147


PHP Basic Data Type Step By Step Tutorial - Part 3: Integer data type is a data type that is expressing Integer. The integer reach depends on platform, it is about 2 billion. Integer can be expressed for the notation of decimal number (bases 10), hexadecimal (bases 16), and octal (bases 8).

The using of octal notation must have early by 0, while the using hexadecimal notation must have early by 0x If you express a value exceed integer number reach, automatically the value will be considered to be the float data type. If you do an operation yielding an value beyond reach integer data type, hence data type of float will become its substitution.

Pay attention to the example of using integer data type at script as following:

(File name: Integer.php)


<Html>
<head>
<title>Integer Data Type</title>
</head>
<body>
<h1>Integer Data Type</h1>
<?
	$price = 20000;
 	$amount = 5;
 	$totalizeing_price = $price * $amount;
	echo "price = $price"."<br>";
	echo "amount of = $amount"."<br>";
	echo "totalizeing_price = 
        $totalizeing_price"."<br><br>";
     $large_number = 5598749870;
	var_dump ($large_number);
	echo "<br>";
	$large_number = 5598749871;
	var_dump ($large_number);
	echo "<br>";
	var_dump(0x80000000);
	echo "<br>";
	$million = 1000000;
	$large_number = 50000 * $million;
	var_dump ($large_number);
?>
</body>
</html>

The result of executing integer.php

Php basic - integer data type



| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting