Archive

Archive for the ‘PHP’ Category

Get IP And Location using PHP

April 22nd, 2010

<?php

$ip=$_SERVER['REMOTE_ADDR'];

echo “<font face=’Verdana’ size=’3′><b>IP Address= $ip</b>”;

$url = “http://www.ipmango.com/api.php?ip=”.$ip; $xml = simplexml_load_file($url);

echo “City : {$xml->city} <br />”;

echo “Region : {$xml->region} <br />”;

echo “Country Name : {$xml->countryname} <br />”;

echo “Latitude : {$xml->latitude} <br />”;

echo “Longitude : {$xml->longitude} <br />”;

?>

Refer: http://www.shefeekj.com/get-ip-and-location-using-php.html

Author: garima Categories: PHP Tags:

Difference Between PHP4 & PHP 5

April 12th, 2010

Difference Between PHP4 & PHP 5

1. Soap, MySQLi and Sqlite extension introduced in php5

2. Exception handling has been introduced in PHP5 (i.e. try and catch statements)

3. Objects can iterate through foreach in PHP5

$object = new IteratorTest();

foreach ($object as $value) {

print $value;

}

4. Added public/private/protected access modifiers in PHP5

5. Introduced Unified constructor name __construct() in PHP5

6. Object destructor support by defining a __destructor() method in PHP5

7. Introduced abstract classes & methods

Good article to go through:

http://devzone.zend.com/article/1714

Author: garima Categories: PHP Tags:

How to check execution time of a page

June 7th, 2009

Code:

// Add this in top of the script

$page_start_time = microtime(true);

 

// Add this in top of the script

if($page_start_time != 0){

       $page_end_time = microtime(true);

$differ = number_format($page_end_time - $page_start_time , 4);

echo “Page Load Time:  ”.$differ.” Seconds”;

}

Author: gaurav Categories: PHP Tags:
Site is Under Construction