The regular:
- Code: Select all
<?php
$txt = "HELLO WORLD!";
echo $txt;
?>
Other way:
- Code: Select all
<script language="php">
$txt = "HELLO WORLD!";
echo $txt;
</script>
Which way should i be using? Are they both correct in syntax?
<?php
$txt = "HELLO WORLD!";
echo $txt;
?>
<script language="php">
$txt = "HELLO WORLD!";
echo $txt;
</script>


BhaaL wrote:the second is rather confusing for some browsers (yes, still!).
http://www.php.net/manual/en/language.basic-syntax.php wrote:The <script language="php"> tag won't be read by browsers; it will be parsed by PHP just like <?php and ?> are.

comperr wrote:not true - PHP parses it

Users browsing this forum: No registered users and 0 guests