You’re overthinking it.
function my_test($var1, $var2){
global $privileges;
$var3 = $var1+$var2;
if($var3 != $privileges){
return false
}else{
return true;
}
}
if( my_test('var1', 'var2') ) {
// true - do code
} else {
//false - don't
}
Assuming that that is just example code, because that really just condenses down to:
if ( $var1+$var2 == $privileges ) {}
and if the vars are strings you can’t use +
on them without implicit conversion to integer, and we sprial down the rabbit hole of the XY problem.
That said, in reference to your general question about being able to create your own language constructs and/or operators in PHP: No.
1
solved Making function with brackets [closed]