Friday, July 24, 2020

PHP: Resource variables

Resource variables hold special handles to opened files, database connections, streams, image canvas areas and
the like (as it is stated in the manual) .

$fp = fopen( 'file.ext', 'r' ); // fopen() is the function to open a file on disk as a resource.
var_dump($fp) ; // output: resource(2) of type (stream)

To get the type of a variable as a string, use the gettype( ) function:

echo gettype(l); // outputs "integer"
echo gettype(true) ; // "boolean"

Source: PHP Notes for Professionals by Goal Kicker - Internet Archive Data
  • rss
  • Digg
  • Twitter
  • StumbleUpon
  • Reddit
  • Share this on Technorati
  • Post this to Myspace
  • Share this on Blinklist
  • Submit this to DesignFloat


Post a Comment