For example if statement
if($number == 1){
echo '$number == 1';
}
Such statement need to call multiple times. And possibly latter the statement need to change.
Can place this code in external file and the use include
.
But better would be create variable something like
$variable = if($number == 1){
echo '$number == 1';
}
This does not work. Tried with ( )
, " "
. No success.
Any ideas? Is it possible at all?
Updated question
Writing one more time for those who write that question is not understandable.
So need this code if($number == 1){ echo '$number == 1'; }
(actually code is much longer) to repeat some 30 times.
And time after time some part of code manually would need to change.
One way how can I do it is to place the code in external file, for example external_file.php and then use require($_SERVER['DOCUMENT_ROOT'] . "/external_file.php");
.
Instead of including external content would want to define/create (now I see that need function).
Hope now is clear what I want.
Thanks for answers, will experiment.