I have a PHP code like this:
<?php
if($condition) {myFunction();};
?>
<html>
<head>
</head>
<body>
Some HTML code
<?php
function myFunction() {
print "Print some new code";
};
?>
</body>
</html>
When the myFunction is called, the new code is printed before the first html tag.
How can I change that behaviour and print, say, after “Some HTML code”.
Thanks!
You have to call the function where you want to print not define it there.
–EDIT–
for comment
Check the conditions in both places, or separate your logic and content