I have some code like this :
somefunc($row['some_key']);
Sometimes, $row might not have 'some_key' which logs an Undefined index
warning.
How do you fix this warning without changing the current behavior of the program ?
I know I need to fix the problem to the source but this is a legacy codebase T_T
My attemp
if(!isset($row['some_key'])){
somefunc(null);
}
else{
somefunc($row['some_key']);
}
Is this equivalent ?