PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, January 27, 2022

[FIXED] what does fopen return?

 January 27, 2022     file-io, php     No comments   

Issue

In the following statement :

$handle = fopen('./readme.txt');

what variable is $handle ? Is it a boolean or what ?

I am in a doubt after running these 2 different statements :

if($handle) echo "File opened !"
else echo "Error opening the file !";

and

$line = fgets($handle);

So what variable is actually $handle ?


Solution

It returns either a resource or boolean false. Resources are known as a special type and are explained in detail here



Answered By - juco
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing