Skip to content

Instantly share code, notes, and snippets.

@umanda
Created February 16, 2015 11:22
Show Gist options
  • Save umanda/8ef64b59443cc1518322 to your computer and use it in GitHub Desktop.
Save umanda/8ef64b59443cc1518322 to your computer and use it in GitHub Desktop.
Illegal string offset Warning PHP
function isset_get($array, $key, $default = null) {
return isset($array[$key]) ? $array[$key] : $default;
}
$myVar = isset_get($someArray, 'someKey');
//or with some default if you got one
$myVar = isset_get($someArray, 'someKey', $mydefault);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment