Archive for April 28th, 2008|Daily archive page

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. )

Welcome to my blog.

Hello everyone, and welcome to my blog.

I’m Jimmie, currently 11 years old, studying at EB2+3 Paula Vicente Secondary School, at Lisbon, Portugal.

I’m currently the best student at the whole 5th grade. I’m good with Maths :)

I’m a Web Developer & Programmer and I’m good with (x)HTML, CSS (Cascading Style Sheets), AJAX, XML (Extended Markup Languange), jQuery (If you ever want to know why I list it here, post a comment and I will answer), and something funny called PHP. The “PHP:HyperText Processor”. MySQL is a good thing for me too :P

On Programming, I know Visual Basic, Java and somethin’ called C++. :D

If you want ever to know more about me, feel free to comment, or expect more silly posts :P