PHP3.0 statements can be easily inserted into HTML, which provides a convenient way to implement dynamic design. For example, if you want to add the current date to an HTML file, we can do this:
< html>
< head>
< Title>our PHP3.0 script</title>
< body>
< center> my first PHP3.0 script </center>
<?
/* the "<" above indicates that the PHP script starts here.
$today = Date ("y-m-d");
PRINT "< center> today is: $today .</center>";
# "?>" means the end of the script
?>
</body>
Assuming today's date is January 20, 2000, the following will be shown:
My first PHP3.0 script.
Today is: 2000-01-20
Looking at this script, here's a little summary:
1. All PHP3.0 statements must be in the "2. Comments can be added to the script. You can use "/*" and "* *" to annotate a paragraph, or use "#" in front of the line to comment out the row.
3. If you want to output the results on the screen, you need to use the print statement, the output of the content should be in double quotes (") enclosed."
4. Each PHP3.0 statement is separated by a semicolon (;) To end.
5. Any HTML statement in PRINT will be interpreted by the client browser to interpret the output.
6. Files containing PHP statements, only after the suffix *.php3 named (such as: MYPHPFILE.PHP3) can be identified by the PHP3.0 interpreter and processed accordingly.
7. The date () function is used as follows:
Syntax:: string date (string format, int timestamp);
This function can have two parameters, the timestamp parameter is optional, and if there is no timestamp argument, the current time is used. The function then returns the corresponding formatted time string according to the given format (given by the format parameter). In the above example, y-m-d the next year, month, day, each with a number. There are many forms of representation, specific reference to the PHP3.0 document.