Archive for the ‘Web Developing’ Category
PHP Basics.
I thought that I could write my 2nd post while I’m here and while I’m installing Apple’s iTunes (ONLY NOW? OMG). So, what is exactly PHP?
PHP -> PHP: Hypertext Processor.
Official Website is http://php.net
And huh…How do we start a PHP Code? Like this?
- Code: HTML
<scripttype="php">
Me: *dies* Of course not. PHP scripts are written to .php files. They start like:
- Code: HTML
<?php
and end like this:
- Code: HTML
?>
Note: <?php can also be replaced with <? (IF YOU HAVE short_open_tag [Or whatever] on at your PHP server) or <% (If you have asp_tags on at your php server)
Now, first script. How do we output something? Or better, show something?
- Code: HTML
<?php
// we start the naughty php tag.
// and we output.
echo 'Show whatever here but don\'t use single quotes unless you escape them. View next part for more info';
// and we finish.
?>
Simple huh? Comments:
To make PHP comments, you can use
- Code:
//
for a single line comment, or
- Code:
/* comment */
. Or just use
- Code:
#comment
for another kind of simple, one-line comments.
ECHO: This outputs. Remember, if you make ECHO using SINGLE QUOTES (‘) you CANNOT USE IT IN YOUR TEXT OR THE SCRIPT WILL BREAK. But you can escape it with a backslash behind them like:
- Code: HTML
\' \" \'
For don’t, you can use:
- Code: HTML
don\'t
So, I think that I will write only until here, and expect more updates to this silly tutorial soon. 
Leave a Comment