note 100526 added to function.simplexml-load-file
| From: | raduispas at gmail dot com | Date: | Thu, 21 Oct 2010 13:12:55 +0000 |
| Subject: | note 100526 added to function.simplexml-load-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173339@lists.php.net to get a copy of this message | ||
if you want to check when this function fails,make sure to compare the return value with ===
instead of == :
$url = 'http://www.example.com';
$xml = simpleXML_load_file($url,"SimpleXMLElement",LIBXML_NOCDATA);
if($xml === FALSE)
{
//deal with error
}
else { //do stuff }
Otherwise you may end up with FALSE all the time even if the document is ok. Hope this helps someone
;)
----
Server IP: 69.147.83.197
Probable Submitter: 91.199.199.23
----
Manual Page -- http://www.php.net/manual/en/function.simplexml-load-file.php
Edit -- https://master.php.net/note/edit/100526
Del: integrated -- https://master.php.net/note/delete/100526/integrated
Del: useless -- https://master.php.net/note/delete/100526/useless
Del: bad code -- https://master.php.net/note/delete/100526/bad+code
Del: spam -- https://master.php.net/note/delete/100526/spam
Del: non-english -- https://master.php.net/note/delete/100526/non-english
Del: in docs -- https://master.php.net/note/delete/100526/in+docs
Del: other reasons-- https://master.php.net/note/delete/100526
Reject -- https://master.php.net/note/reject/100526
Search -- https://master.php.net/manage/user-notes.php