In Python I can use "get" method to get value from an dictionary without error.
a = {1: "a", 2: "b"}
a[3] # error
a.get(3, "") # I got empty string.
So I search for a common/base function that do this:
function GetItem($Arr, $Key, $Default){
$res = '';
if (array_key_exists($Key, $Arr)) {
$res = $Arr[$Key];
} else {
$res = $Default;
}
return $res;
}
Have same function basicly in PHP as in Python?
Thanks: dd