What is resource data type in php? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is resource data type in php?

Give an example of implementation of resource data type in php

18th Feb 2018, 2:09 PM
Bharat Chaturvedi
Bharat Chaturvedi - avatar
1 Answer
0
A resource is a special variable, holding a reference to an external resource. Resource variables typically hold special handlers to opened files and database connections. Ex: <?php // Open a file for reading $handle = fopen("note.txt", "r"); var_dump($handle); echo "<br>"; // Connect to MySQL database server with default setting $link = mysql_connect("localhost", "root", ""); var_dump($link); ?> Reference# https://www.tutorialrepublic.com/php-tutorial/php-data-types.php
6th Apr 2018, 7:03 PM
Sanjeev Bomma
Sanjeev Bomma - avatar