Re:Five reasons why the PHP silence operator @ should be avo...
by jtreminio on Thursday January 10, 2013 @02:40PM
(#5039239)
> if(function_exists(custom_func) { $x = @custom_func(); }
http://php.net/manual/en/function.call-user-func.php
Why would you prepend @ to your function call?
> if((!isset($x)) || (empty($x))) { echo('Custom Error'); } else { //Do the work }
You're duplicating your efforts. empty() takes into account if a variable or key has been initialized, and also if it has a non-false value. isset() only checks if the variable/key has been intialized and nothing else.
if(function_exists(custom_func) { $x = @custom_func(); }
if((!isset($x)) || (empty($x))) { echo('Custom Error'); } else { //Do the work }
This may be considered verbose, but can be useful if custom or "sometimes" installed libraries are involved