Home Tutorial Php Phpbasics Tutorial PHP Resource Associates

 
 

PHP Resource Associates
Posted on: March 16, 2010 at 12:00 AM
Advertisement
In this tutorial you will come to know about resource in PHP, it is a new kind of variable introduced in PHP. It is used to make and keep a reference of another file or connection with the database etc.

PHP Resource Type:

In PHP, resource is a special type of variable. Main task of this variable is to hold a reference to an external resource like   connection to database, a file etc.

In PHP 4's Zend Engine a reference counting system is introduced, if no resource is automatically detected then it is freed by garbage collector. That's why we do not need to free the memory manually.

PHP Resource Example:

<?php

$a=mysql_connect("localhost","root","");

echo get_resource_type($a);

?>

Output:

mysql link

Advertisement

Related Tags for PHP Resource Associates:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 16, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com