It's possibly to create function like if,when,for ? I mean this:
<?php
function func_like_if($var1, $var2){
global $privileges;
$var3 = $var1+$var2;
if($var3 != $privileges){
// false - pass
}else{
//true - can't pass, do code
}
}
func_like_if('var1', 'var2'){ // <--- can write here brackets ?
// true - do code
} //<--- can write here brackets ?
//false - don't
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.
You can use Ternary Operators
$value = ("condition" ? true : false);
I supose you want a true / false return. Please give us aditional info