Display text
Basic Operation in PHP, the display text can be done in different ways. We will see the easiest and fastest (in terms of processing time server) to display text. This is the "function" echo () (it is a structure of language in reality and not a function, in fact it is not obligatory to use it with parentheses).
Here is an example of displaying text using echo:
Code:
<? php
echo 'hello! " / / Displays the text "hello!"
?>
It's all well and good but if you want to see an apostrophe how do we do? Well just add the \ (backslash) in front of the apostrophe to add. One small example is worth a thousand words:
Code:
<? php
echo 'l \' apostrophe in the middle of \ 'a string';
? >
You could also write it like this (with double quotes):
Code:
<? php
echo "l' apostrophe in the middle of a string ";
? >
The first example is faster to deal with PHP (on talk of timeliness in the section dealing with the optimization of PHP).
Each instruction ends with a semicolon in PHP, do not forget it because you will make mistakes sometimes intractable if your code is long.
Bookmarks