Isset a variable which name of the left 3 characters is 'var'

$var='abc';
[-3-]if(isset($var)){
[-4-]echo 'yes';} else {
[-5-]echo 'no';}

The code above produces ‘yes’.
If there is no $var before the if-clause, it will produces “no”.

Let’s suppose I have a variable named ‘var??’.
I know only 3 left letters of the variable name.
I like to know the variable is set or not.

The would-be-code below does not work correctly, but I hope it shows what I want.

[b]woulde-be-code[/b]
$var1='abc';
if(isset($left(varName,3)='var')){
echo 'yes';} else {
]echo 'no';}

How can I check whether a variable which I know only 3 left letters of the variable name
is set or not?

Instead of trying to patch together variable names, it’s better to use data structures such as arrays.

$vars = [
    'abc',
];

if (!empty($vars)) {
    echo 'yes';
} else {
    echo 'no';
}

// yes
$vars = [
];

if (!empty($vars)) {
    echo 'yes';
} else {
    echo 'no';
}

// no