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

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -