Difference between revisions of "PHP code island"
From Wiki @ Karl Jones dot com
Karl Jones (Talk | contribs) (Created page with "In PHP, a '''code island''' (or '''code block''') contains PHP code. == Description == A PHP page commonly contains a mix of HTML and PHP code. All of your PHP code mus...") |
Karl Jones (Talk | contribs) (→Example) |
||
Line 22: | Line 22: | ||
The above code sample is a mix of HTML (a paragraph tag), and a PHP code island (which will display "Hello World" for the user, inside the paragraph. | The above code sample is a mix of HTML (a paragraph tag), and a PHP code island (which will display "Hello World" for the user, inside the paragraph. | ||
+ | |||
+ | The '''[[PHP text generation|echo]]''' keyword generates the text ''Hello World'' (the text inside the quotation marks -- not the quotes themselves). | ||
== See also == | == See also == |
Revision as of 18:51, 20 September 2016
In PHP, a code island (or code block) contains PHP code.
Contents
Description
A PHP page commonly contains a mix of HTML and PHP code.
All of your PHP code must be inside a code island.
PHP code islands must not include HTML, CSS or JavaScript; using these languages inside a code island will trigger a PHP error.
Example
Here is a simple example of a PHP code island:
<p> <?php echo "Hello World"; ?> </p>
The above code sample is a mix of HTML (a paragraph tag), and a PHP code island (which will display "Hello World" for the user, inside the paragraph.
The echo keyword generates the text Hello World (the text inside the quotation marks -- not the quotes themselves).