<?php
function isset_or(&$check, $alternate = NULL)
{
return (isset($check)) ? $check : $alternate;
}
$orig = ['alpha' => 1];
$tested = $orig;
echo 'isset_or($tested["beta"]): ', isset_or($tested['beta'], 'nope');
var_export([
'$orig' => $orig,
'$tested' => $tested,
'array_key_exists("beta")' => [
'$orig' => array_key_exists('beta', $orig),
'$tested' => array_key_exists('beta', $tested),
],
]);
preferences:
59.84 ms | 404 KiB | 5 Q