ss_blog_claim=3f4ffd837502643f53746c9e0ca5131b

Learning php: Lesson 1

00:14 July 16th, 2008 by shadow_of__soul

Hi,

i dont know how much lines of code i write in my life, surely i wrote more than 1000 files of php of 300 lines each, at least… for that, i want to share my knowledge about this marvelous languaje, and for that, we need to start form the beginning.:D

i try to post 1 entry per day, i hope in 15 or 20 days, you can learn with my tutorial, all the basics and advanced things about the web develoment with php.

well, now, start with the lesson:

what it’s php?:

php ( PHP Hypertext Pre-processor) it’s a interpretated  computer programing language, designed to make dinamic web pages. like it’s a dynamic language, it dont need to be compilated to a binarie language, it’s parsed by a interpreter what evalue the instrucction and output th result.

ok, i know what it’s php, now, how i can make my website ?

ok, i going to tell you that, but first you need to get the tools to make it :D first of all, you need a editor, to wrte plain text what are the php code and the webpage itself. you can use notepad or any default text editor, or some specific (and recomended) editor, with highlight of syntaxis like geany or crimson editor. also, you going to need the php interpreter and a web server to tet your php script, you can learn more about this here or buy some host plan (the best option).

Great :), i have the editor and my host running, now how i write php code ?

you has been reached this step, what it’s great, you going to write your first php script. for this we going to use a example code, a hello world made in php:

<?php
echo "Hello World";
?>

now, save the file like hello_world.php and put in the directory of your host (normally, you directory it’s like www or public_html) and run in (open in the browser www.yoururl.com/hello_world.php ) and see the magic :)

easy uh? yea, now, i explain each line of the code:

<?php = this it’s the open tag of php, you need to enter this before before any php code, with this you are telling to the webserver need to parse that part of code.you can open and close the php tag several times, only make sure you close the tag before to open another.

echo “hello world”; = here you are usng the function echo, to print a string in the screen. echo accept strings, variables or html code to output to the screen. aso you see, i’m usin ” around the text to scpecific it are strings. always all the functions, variables declaration, need to finish with a ; at the end.

?> = this it’s the closer tag of php, this define the end of the php code.

WoW i’m impressed, it’s very easy, but how i can make my website with this?

well, php it’s a great language, with a tons of function what going to help you to make this, but you going to need to wait till tomorrow to know more about this fantastic language :D

see you later guys and i hope you find this useful.

Regards,

Shadow.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]