arrays - PHP error suppression or isset -


i have array of more 50 indefinite keys means not sure 1 particular field there or not. have 2 option assign array values other.

first

 $array2['someothefield'] = isset($array1['somefield'])?$array1['somefield']:null; 

second

 $array2['someotherfield'] = @ $array1['somefield']; 

can please suggest ,which 1 better case. or, there way can suppress errors 1 block of code .

if need code fast, second option better due experience profiling php code.

if going 50 elements, use first option, because it's clear kind of problem trying avoid.


Comments

Popular posts from this blog

symfony - InvalidConfigurationException in SecurityExtension.php line 429: No authentication listener registered for firewall "secured_area" -

angular ui router - 10 digest iterations reached in angularjs when using $state.go -

javascript - Handling constructor related functions while testing with mocha and sinon -