Difference between revisions of "Learning PHP (2)"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
(Example One: date and time)
(Example One: date and time)
Line 16: Line 16:
 
Observe how the above code snippet mixes HTML with PHP code islands.
 
Observe how the above code snippet mixes HTML with PHP code islands.
  
[http://code.karljones.com/php/date/ View online]]
+
[http://code.karljones.com/php/date/ View online].
 +
 
 +
Use your browser's View Source or Inspect Element to confirm that the [[web page]]'s [[source code]] contains only HTML, no PHP.
  
 
== See Also ==
 
== See Also ==

Revision as of 08:53, 3 September 2015

This article contains examples of PHP.

Example One: date and time

PHP provides the date() function, which returns date and time.

The date and time can be formatted and used in a variety of ways.

Code snippet:

<p><?php echo date("Y/m/d"); ?></p>
<p><?php echo date("l"); ?></p>

Observe how the above code snippet mixes HTML with PHP code islands.

View online.

Use your browser's View Source or Inspect Element to confirm that the web page's source code contains only HTML, no PHP.

See Also

External links

Documentation

Tutorials