PHP 8.6.0 Alpha 2 available for testing

Voting

: four plus one?
(Example: nine)

The Note You're Voting On

line dot loic at gmail dot com
10 years ago
To avoid infinite loops and the warning :
"Warning: feof() expects parameter 1 to be resource, boolean given"
You need to check that the fopen function return the correct type.
This can be achieved very easily with gettype().
Here is an example :
$source = fopen($xml_uri, "r");
$xml = "";
 
if(gettype($source) == "resource") { // Check here !
 while (!feof($source)) {
 $xml .= fgets($source, 4096);
 }
}
echo $xml;

<< Back to user notes page

AltStyle によって変換されたページ (->オリジナル) /