[programming] PHP : Introduction

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??

  1. Database Integration
    PHP support lots of database such as :
    ▫          MySQL
    ▫          PostgreSQL
    ▫          Msql
    ▫          Oracle
    ▫          Dbm
  2. Built –in Libraries
    PHP has many Built-in Function to perform web-related task, such as :

    • Send email
    • Generate PDF Documents
    • Work With Cookies
  3. 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
  4. Easy To use
    Code is embedded into HTML. The PHP code is enclosed in special start and end tags that allow you to jump into and out of “PHP mode”.Also embedded into another Web Programming Language such as : XML, Javascript, VBScript, or ASP
  5. Portability
    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/
Example :
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

PHP Code is written inside the <?php  ….  ?> tag, must enclose in all script code. And each statement should be ended with semicolon (;)


The best things about web programming is the code is embedded into HTML tag such as JSP, Javascript, ASP also has this special treatment as a matter of fact, that’s why I love PHP. Allow me to program at the same time design the look of the web. 😀


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 :

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.
example :
$Book different with $book.
so..keep an eye.

variables name should follow the rules of naming the variable such as :

  1. Variables name should start only with character or “_” (underscore)
  2. Should not contain any space.
  3. Do not use special character, (!@#$%^&*)
  4. Should not use PHP Keywords (if, else, for etc)

$_bookname (right)
$book name (wrong)

Just like lots of programming language, PHP also has several operator to work with there are :

    1. Arithmetic Operator
      this Operator contain symbol – symbol you can use to do basic mathematical calculations.

      Aritmathics Operator Table
      Operator Description
      + Addition
      * Multiplication
      / Division
      % Modulus
      ++ Increment
    2. Logic Operator
      Logics Operator Table
      Operator Description
      && And
      || Or
      ! Not
    3. 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
    4. 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

3 thoughts on “[programming] PHP : Introduction

  1. Pingback: [programming] PHP – Array | Dream and Share

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s