View Full Version : Here's an easy one for you...
BLiZZaRD
09-22-2006, 10:51 AM
What is the point of doing this:
<?php } ?>
at the very end of a source code? I have seen several php pages that end with that, something like:
<html>
<head>
<title>Words</title>
</head>
<body>
<? php
code stuff here
?>
html stuff here
<img src= "letsputinapic.jpg">
</body>
</html>
<?php } ?>
What is the point?
blm126
09-22-2006, 11:10 AM
THey are closing something like an if,else,switch,for,whatever.Here is an example.
<?php
if($_POST['password'] == 'secret password'){
?>
Super secret Information
<?php
}
?>
BLiZZaRD
09-22-2006, 11:12 AM
So, why the need for the closing and opening ?> <?php then? Shouldn't the statements be closed before the other information is parsed to/from the server? Or is it like a "catch all" for incase they forgot to close it earlier?
mwinter
09-22-2006, 11:16 AM
What is the point of doing this:
<?php } ?>
at the very end of a source code?
On it's own, there is no point (and should raise a syntax error). However, code blocks can span raw output. For example,
<?php
if (condition) {
?>
Some text...
<?php
}
?>
"Some text..." will only be output if condition is true.
Mike
BLiZZaRD
09-22-2006, 11:21 AM
OHHHHHH... same thing blm said... just different, LOL
Thanks guys, I get it now! :D
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.