Monday, 28 November, 2022

webmastertools4u

Webmaster Tools

single post

  • Home
  • PHP document structure
PHP

PHP document structure

PHP comments and PRINT command
 


 

Well, you’ve already configured your software and now are ready to learn PHP. All your PHP documents must be saved with the *.php extension. Be sure to ask your hosts which PHP version is installed on their server. If it is PHP3.0, then save your PHP documents with the *.php3 extension, or ask your hosts if they could upgrade.

PHP code is embedded in your HTML script.
Almost every PHP command is ended with a semi-colon (;).
Your PHP code must be enclosed within the “<?” and “?>” or “<?php” and “?>” brackets.

An example:

<html>
<head><title>Example</title></head>
<body>

<?php
PRINT “<center>Hi! This is a PHP example.</center>”;
?>

</body>
</html>

The output in your browser would be:

Hi! This is a PHP example.

Well, we used PHP PRINT command that outputs all statements enclosed in double quotations (“). Notice that we placed HTML commands <center>…</center> within the PRINT statement and the HTML code was interpreted by the browser.

Sometimes it is very useful to insert comments into your PHP documents. Use one of these commands:

/* This is a multi line comment. */
// Another way to comment your script. This is a one-line comment.
# One more one-line comment.

Well, let’s go to the next tutorial PHP variables.

Recent Comments

No comments to show.

Archives

Categories