News for hackers. Stuff that matters.
Re:Five reasons why the PHP silence operator @ should be avo... by parf73 on Thursday January 10, 2013 @12:40PM (#5038406)
@operator is much faster in 5.4.x

$x = @$f["x"] is right place to use it.

$x = @custom_func() - is a disaster, do not do it

Re:Five reasons why the PHP silence operator @ should be avo... by jtreminio on Thursday January 10, 2013 @12:49PM (#5038466)
> $x = @$f["x"] is right place to use it.

No, it's not. There's built-in methods for that: isset() and empty().

Re:Five reasons why the PHP silence operator @ should be avo... by narcissus on Thursday January 10, 2013 @01:09PM (#5038595)
Or array_key_exists(), depending on exactly what you're hoping for :(
Re:Five reasons why the PHP silence operator @ should be avo... by pavel_lishin on Thursday January 10, 2013 @04:52PM (#5040023)
empty() is not a good idea. What if $f["x"] is an empty string ""? Or 0, or 0.0, or "0", or any of the other values for which it returns true?
Re:Five reasons why the PHP silence operator @ should be avo... by jtreminio on Thursday January 10, 2013 @08:30PM (#5040858)
It completely depends on the use case. My point was, don't use @
Re:Five reasons why the PHP silence operator @ should be avo... by neurotech1 on Thursday January 10, 2013 @01:43PM (#5038850)
so what is wrong with;

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

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.