PHP was originally named Personal Home Page, but was then later renamed to PHP: Hypertext Processor which sounds more powerful.
- Code inside tags is executed
- Only output sent to browser
- Client will never see the PHP code (when they click view source on a page for example)
- Syntax
- Three variations but all the same (gives same result)
<?php ... ?>
<? ... ?>
<script language = "php"> ... </script>
- Three variations but all the same (gives same result)
- PHP requires a semi colon at the end of each sentence
;
- We use
echo
to print out to the screen. This is the equivalent toprint()
in for example Python orSystem.out.println
in Java. - To concatenate PHP uses
.
This is the equivalent of using a+
for other languages such as Java/Python. - To comment in PHP use
//
or#
for single line comments. A block comment is/* ... */
echo "Hello " . "World!"; //Will output Hello World!