Can I write code like below in php?
$operator = ">=90";
$val = 100;
if($val.$operator){
echo "Correct!";
}
Look into the eval() function. Though, I would say you should look into closures and even arrow functions.
$operator = fn($x) => $x >= 90;
$val = 100;
if($operator($val)){
echo "Correct!";
}