How to reuse the code of the if condition in php I have an if condition (which is composed of multiple expressions), which is used on many pages, but this condition changes at any time, for example, if & nbsp; (condition) & nbsp; {statement}, how can I reuse the code of this condition? Thank you very much! How does PHP reuse the if condition code in php?
I have an if condition (composed of multiple expressions), which is used on many pages, but this condition changes at any time, for example:
If (condition)
{Statement}
How can I reuse code with this condition? Thank you very much!
PHP code reuse
Share:
------ Solution --------------------
Define
------ Solution --------------------
$ Expr = 'conditional expression ';
If (eval ("return $ expr ;")){
...
}
However, you must ensure that all the variables involved in the operation exist.