which is slower? error surpressing or a dedicated function?

rentdn

New Member
A simple question.Take this:\[code\]$data = http://stackoverflow.com/questions/3937074/array('one'=>'1','three'=>'3');\[/code\]Now which is better?This:\[code\]echo @$data['two'];\[/code\]or this:\[code\]function val($data,$key,$default){ if(isset($data[$key])){ return $data[$key]; } return $default;}echo val($data,'two','');\[/code\]or this:\[code\]echo isset($data['two'])?$data['two']:'';\[/code\]or something else?avoiding the notice: Notice: Undefined index: two in document on line #numwhich one is the most efficient, and which one should I use?I am wondering that maybe the super-slow error suppressing might be faster than having a dedicated function?p.s. most efficient and which used will most likely be different
 
Back
Top