Senin, 30 Juli 2012

Examples little PHP program

PHP program



Sample Program

Hello World Program

Hello World program written in PHP is as follows:

<? php

     echo "Hello World";

?>

 

Program Fibonacci numbers

   Here is an example of a relatively more complex programs written using PHP. Examples of these programs is the program to display the first 20 numbers of the Fibonacci series of numbers.

<? php

fibonacci_seq function ($ term) {

    for ($ l = array (0.1), $ i = 2, $ x = 0; $ i <$ length, $ i + +)

         $ l [] = $ l [$ x + +] + $ l [$ x];

    return $ l;

}


fibonacci_seq (20);

/ / The number "20" can be changed as desired

?>


Type of data


PHP has 9 (nine) data types are:


1. integer

2. Double

3. boolean

4. string

5. object

6. array

7. null

8. Nill

9. Resource


Tidak ada komentar:

Posting Komentar