I did tell you before that I am a PHP Girl rather than a Java woman. And this is love of my life..😀 they said we are soulmate, that’s why I fell for him since the first time I tried to spell W-E-B. I am happy to talk about you, PHP. I do… I really do. So don’t doubt me and my feeling for you is real. As real as my existence on the earth… muahahahahahahaaa
PHP stands for Hypertext Pre Processor (don’t ask me where the first P goes to, they never tell me anything) is a server side scripting language where the script executed in the server side and send the output as the html document on the user’s computers. The good things about web based program is you can embed your programming language into your HTML tags.
So.. why PHP??? When there is lots of programming language scattered on the world of internet??
- Database Integration
PHP support lots of database such as :
- Built –in Libraries
PHP has many Built-in Function to perform web-related task, such as :
- Send email
- Generate PDF Documents
- Work With Cookies
- Low Cost
PHP is free. Open source code means that the entire PHP community will contribute towards bug fixes. There are several add-on technologies (libraries) for PHP that are also free
Free Download the latest Version of PHP in http://www.php.net
- Easy To use
Available for many different Operating SystemsWeb Servers: Apache, Microsoft IIS, Caudium, Netscape Enterprise ServerOperating Systems: UNIX (HP-UX,OpenBSD,Solaris,Linux), Mac OSX, Windows NT/98/2000/XP/2003
- Web Server Installation either in Windows or Linux
- PHP-Engine Installation
- Database Installation, We Use MySQL
You can Install those 3 Application by Installing a bundle Software such as XAMPP, WAMPP, Apache2triads, etc
Then, before you start to write the code. You should know how to save and compile PHP page. it’s a basic information, if you already know the case, you can go on to the Write Code part.
The first thing that you have to keep in mind is, the page that consist of PHP code should be saved in PHP extension. then, when you are a XAMPP user, then you should save it under C:/xampp/htdocs/folder_name (by default) or the drive might be different depend on the drive you’ve set when you installed XAMPP for the first time. when you didn’t change anything, xampp folder should be on C Drive.
After you save the page, make sure that XAMPP service has been start. to check whether the service has been start or not, you can double click on xampp-control on XAMPP folder in Drive C. When Apache service has been labeled as ‘running’ then you can start running you PHP page on your browser.
To start compiling, start with opened up you browser. and then type ‘http://localhot/folder_name/file_name.php/ ‘
when your file named start.php that saved under C:/xampp/htdocs/web/ (note : web is your self defined folder), then you should use ‘http://localhost/web/start.php ‘ to compile the page
WRITE THE CODE
PHP Code is written inside the <?php …. ?> tag, must enclose in all script code. And each statement should be ended with semicolon (;)
<?php PHP STATEMENT; ?>
PHP has two kinds of comment,
you can either use ‘//’ symbol to make a single line comment
or you can use the combination of ‘/* comment */’ to make multi line comment. Either way is do, adjust to your needed.
Variable in PHP is represented by a dollar symbol followed by variable’s name and variable is case sensitive. and for this matter (case sensitive) if you are a programmer geek you might not have any trouble in this area. but if you are a newbie, in this case you are a high scholar who just try to dig in a programming are, you should watch this. case sensitive means that the variable is unique, change the case means different variable’s name.
$Book different with $book.
so..keep an eye.
variables name should follow the rules of naming the variable such as :
- Variables name should start only with character or “_” (underscore)
- Should not contain any space.
- Do not use special character, (!@#$%^&*)
- Should not use PHP Keywords (if, else, for etc)
$book name (wrong)
Just like lots of programming language, PHP also has several operator to work with there are :
- Arithmetic Operator
this Operator contain symbol – symbol you can use to do basic mathematical calculations.
Aritmathics Operator Table Operator Description + Addition – Substraction * Multiplication / Division % Modulus ++ Increment — Decrement
- Logic Operator
Logics Operator Table Operator Description && And || Or ! Not
- Assignment Operator
Assignment Operator Table Operator Example Is The same as = x = y x = y += x += y x = x + y -= x -= y x =x – y *= x *= y x =x * y /= x /= y x =x / y %= x %= y x =x % y
- Relational Operator
Relational Operator Table Operator Description == Is Equal to != Is not equal to > Is greater than < Is Less than >= Is Greater than or equal to <= Is less than or equal to