How do I form an if/else statement for a PHP function failing? I want it to define $results one way if it works and another if it doesn’t. I don’t want to simply show an error or kill the error message if it fails.
Currently, I have:
if(file_get_contents("http://www.address.com")){
$results = "it worked";}
else {
$results = "it didnt";}
return $results
if(@file_get_contents("http://www.address.com");){ $results = "it worked";} else { $results = "it didnt";} return $resultsBy prepending an @ to a function, you can surpress its error message.