0

Is using @ to repress errors considered bad practice? Take this code for an example:

...
$an_array = false;

if (something) $an_array = array("key" => "value); 

if (array_key_exists("key", $an_array)) ...

In my structure it can be, that an_array is still false when I want to use array_key_exists() on it. Is it considered bad practice to do: @array_key_exists()? Shall I use if (is_array($an_array) AND array_key_exists(...)) instead?

Stef
  • 151
  • 1
  • 9

0 Answers0