PHP/Basic Code
From r00tedvw.com wiki
(Difference between revisions)
Line 11: | Line 11: | ||
:just like with scripting, '''echo''' can be used to output text | :just like with scripting, '''echo''' can be used to output text | ||
<nowiki>ie. | <nowiki>ie. | ||
− | + | <p> | |
− | + | <?php | |
− | + | echo "My first line of PHP!"; | |
− | + | ?> | |
− | + | </p></nowiki> | |
+ | ==Operators== | ||
+ | ===concatenation=== | ||
+ | :joins strings together | ||
+ | <nowiki> | ||
+ | <?php | ||
+ | echo "Hello," . " " . "world" . "!"; | ||
+ | ?> | ||
+ | ---- | ||
+ | Outputs: Hello, world!</nowiki> |
Revision as of 00:31, 26 December 2015
Contents |
Basics
- .php
- all PHP pages end with the .php extension, this tells the browser there is php code in the file.
delimiters - start & stop
- <?php
- all php code begins with this.
- ?>
- all php code ends with this
output text
- echo
- just like with scripting, echo can be used to output text
ie. <p> <?php echo "My first line of PHP!"; ?> </p>
Operators
concatenation
- joins strings together
<?php echo "Hello," . " " . "world" . "!"; ?> ---- Outputs: Hello, world!