Home >> General What is PHP? [Page 2] Article by: Shelton Manage Thursday, 21st May, 2009
Opening & Ending PHP Tags
To open a block of PHP code in a page you can use one of these four sets of opening and closing tags
| Opening Tag |
Closing Tag |
|
?> |
|
?> |
| <% |
%> |
|
|
|
The first pair (and ?>) is called short tags. You should avoid using short tags in your application especially if it's meant to be distributed on other servers. This is because short tags are not always supported ( though I never seen any web host that don't support it ). Short tags are only available only explicitly enabled setting the short_open_tag value to On in the PHP configuration file php.ini.
So, for all PHP code in this website I will use the second pair, and ?>.
Now, for the first example create a file named hello.php ( you can use NotePad or your favorite text editor ) and put it in your web servers root directory.
Page: First - 1 2 - Last
|