This article covers basic PHP syntax, including variable usage,
variable types, and several ways of printing variables to the
web browser. Embedded code blocks PHP is an embedded web
development language with many similarities to commercial
packages such as Microsoft's Active Server Pages (ASP) or Cold
Fusion. One of the similarities between PHP and these packages
(especially ASP) is the ability to jump between PHP and HTML
code quickly and easily. The basic syntax to jump in and out of
PHP follows: <html> <head> <title>My first PHP page</title>
</head> <body> This is normal HTML code <?php // PHP code goes
here ?> Back into normal HTML </body> </html> In this example,
we see that PHP code is signified by the use of the <?php to
begin the PHP block and ?> to signify the end of the code block.
Although this a completely acceptable method of encapsulating
your PHP code there are many other ways that are all, as far as
syntax is concerned, correct. Here are some other ways to mark
PHP code blocks. |Valid syntax