PHP is a server-side scripting language. PHP code is embedded in the HTML code. When this is executed on the server, HTML code understandable by the browser is sent to the client. This HTML code in then executed on the browser of the client machine.
A PHP block should always be enclosed within the following tags:
1 2 3 4 5 | <?php //code here ?> |
a short form notation depending on whether its allowed on the server, would be
1 2 3 4 5 | <? //code here ?> |
However, it is recommended that you use the standard form instead of the shorthand form, as the server needs to support shorthand notation and
some servers may not support this.
Example:
PHP is a server-side scripting language. PHP code is embedded in the HTML code. When this is executed on the server, HTML code understandable by the browser is sent to the client. This HTML code in then executed on the browser of the client machine.
A PHP block should always be enclosed within the following tags:
1 2 3 4 5 6 7 8 | <html> <body> <?php echo "hello world"! ?> </body> </html> |
Output
Hello World!