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
Post a Comment