Hi,
I'm fairly new to PHP and am trying to integrate some code that I've downloaded from the web. What I need help with is in situations when an error is generated.
Here's the code:
$complete = $info['files'][hex2bin($infohash)]['complete'];
I believe this calls a function from the script that I downloaded and it's suppose to return a number depending on information from another source (website). If the information is not present, then it returns an error:
Notice: Undefined index: (¡ï "€#WyÉr‹@ÇAYŒË in \web\index_main.html on line 153
My question is: Are there any ways I can catch this error when it occurs?
If {$complete = $info['files'][hex2bin($infohash)]['complete'] generates ERROR} then ($complete = 0)
It would be necessary for this function to absorb the error as well so that it doesn't get reported to standard output.
Or is there something similar to the Expect Tcl function "catch" where
catch ($info['files'][hex2bin($infohash)]['complete']😉 will return TRUE if an error occurs and FALSE otherwise.
I've seen many custom error handling functions but they seem cryptic to me.
Thanks in advance for any help possible.