This is probably a bit more of a technical question on how PHP itself works, but I was wondering if someone had an answer.
I have many a time seen, and used, functions that look like this:
Code: Select all
<?php
function show_form() { ?>
<form method="post">
<input type="text" value="somevalue" />
</form>
<?php
}
?>Switching back and forth between PHP and HTML to make a function that can display HTML easily.
I don't understand how this works, wouldn't closing the PHP tag just make PHP wait till the tag opens again, negating any sort of content in the middle? This isn't the case obviously, can anyone explain why?