1.

Explain resources with examples?

Answer»

Resources : Resource is a specific variable, it has a reference to an external resource. These variables hold specific handlers to handle files and database connections in respective PHP program.

<?php

// Open a file for reading

Shandle = fopen(“note.txt” , “r”);

var_dump($handle);

echo “<br>";

// Connect to MySQL database server with default setting

Slink = mysql_connect(“localhost” , “root” , “”);

var_dump(Slink);

?>



Discussion

No Comment Found