Difference between revisions of "Learning PHP (1)"

From Wiki @ Karl Jones dot com
Jump to: navigation, search
(PHP files)
(PHP and HTML)
Line 25: Line 25:
 
== PHP and HTML ==
 
== PHP and HTML ==
  
...
+
PHP pages can contain HTML (and CSS, and JavaScript), which behaves the same as it does in [[static web pages]].
 +
 
 +
== PHP code islands ==
 +
 
 +
PHP code islands (or code blocks) contain PHP code.
 +
 
 +
PHP code islands must not include HTML, CSS or JavaScript;  using these languages inside a code island will trigger a PHP error.
 +
 
 +
You can use PHP code to generate HTML and other languages (see [[echo (PHP)]]).
 +
 
 +
You can freely mix HTML and code islands in a PHP page.
 +
 
 +
A PHP page can be all PHP -- one code island, no static HTML.
  
 
== See also ==
 
== See also ==

Revision as of 16:36, 29 August 2015

This article introduces PHP for the complete beginner.

Requirements

Getting started with PHP requires:

Web server with PHP interpreter

Most web servers, including the widely-used Apache HTTP Server, have the PHP interpreter pre-installed.

Text editor

You can use any text editor to edit PHP files.

PHP files

PHP files have the .php extension.

PHP and HTML

PHP pages can contain HTML (and CSS, and JavaScript), which behaves the same as it does in static web pages.

PHP code islands

PHP code islands (or code blocks) contain PHP code.

PHP code islands must not include HTML, CSS or JavaScript; using these languages inside a code island will trigger a PHP error.

You can use PHP code to generate HTML and other languages (see echo (PHP)).

You can freely mix HTML and code islands in a PHP page.

A PHP page can be all PHP -- one code island, no static HTML.

See also

External links