|
PHP is a language that was designed to be easily embedded into HTML pages. Most PHP pages have PHP code and HTML intermixed. When a Web server reads a PHP page, it is looking for two things to let it know it should start reading the page as PHP rather than HTML, the start and end PHP tags: , respectively. If you have configured your php.ini file to accept "short tags" (which are enabled by default), then you can use the syntax instead. Additionally, you can configure your php.ini file so that it accepts ASP style tags, <% and %>. This feature is turned off by default, and its only real purpose seems to be to allow certain HTML editors to recognize the in-between code as something other than HTML, in which case the editor won't mangle the code by imposing its own set of HTML syntax rules upon the code.
Get Started: !
The code above, when viewed via a Web server, simply prints out String enclosed in the quotes. In general, individual lines of PHP code should end with a semicolon, although it is not necessary to use semicolons if a beginning or an ending bracket is used (this will make sense when you look at if/then statements). For example: echo " a line of code"; echo " another line of code; ?>
|