When I wrote PHP code in the past, I was often embarrassed by the fact that I had to insert my HTML code into calls to print, echo, or the like. To some extent, this is facilitated by the ability to make parts of the code literally output by closing the PHP tag and reopening it after exiting, for example:
<?php ?>
Some HTML code.
<?php ?>
However, I never understood how this relates to functions. For example, it is not clear to me whether:
<?php
function myFunction() {
?>
Some HTML
<?php
}
?>
Will it generate a function that, after a call, displays this HTML if the function is parsed as empty, but displays this HTML during parsing, or none of them, or if this construction is completely illegal?
, - PHP, , undefined , , PHP, , .
- , .