i have the following code with variable and text inisde for sending a form. My problem is that I cant figure out how to execute php inside that text, for example foreach function.
$somearray;
$variable = <<<END
Hello world foreach($somearray as $v){echo $v} //this does not work of course in my case.
END;
you help would very much appreciated.
thank you
the
<<<END&END;are synonymous with using quotations marks, just less the use of\"100 times. You can’t execute code within a string, you’ll need to concatenate the results instead.What you’re trying to do is basically this:
When really you most likely want this: