Introduction to PHP






3 Questions


Why web Programming language ?

What web Programming languages ?

Where to start from ?


    1 - Why web programming language ?

    Products


    Contact US


    Authentication & Authorization


    • Upload & download files
    • Deal with Database
    • Manage & view content
    • Send Emails
    • Authentication & Authorization

    • & so on .


    Server side

    programming language
    to manage all this stuff .


    2 - What web Programming languages ?


    PHP,  ASP, Perl, Python

    Scala,  Ruby

    @sk Google

    "list of web languages"


    PHP


    PHP is a popular general-purpose scripting language that is especially suited to web development.


    Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.


    Hypertext Processor !!

    3 - How to start coding PHP


    We need Environment

    • Web server ( Apache )
    • Database server ( MySQL )
    • PHP interpreter

    Windows

    Xampp
    www.apachefriends.org

    Wamp
    www.wampserver.com

    Linux

    Lamp
    @sk Google
    " install LAMP server "

    Where to write code


    Any simple text editor

    Notepad
    Sublime Text 2
    Notepad++


    Hello World

    <?php
        echo "Hello World";
    ?>

    Xampp install folder -> htdocs -> helloworld.php
    Start Xampp & go to

    http://localhost/helloworld.php

    Hello World

    Hello World


    PHP & HTML

    <!DOCTYPE html>
    <html>
        <head>
            <title>PHP Hello World</title>
        </head>
        <body>
            <b><?php echo "PHP & HTML"; ?></b>
        </body>
    </html>


    PHP & HTML

    Variables

    <?php
    $name = "Hazem Noor";
    $age = 26;
    echo "My name is ".$name." I'm ".$age." years old";
    ?>

    Predefined Variables


    $_GET
    http://localhost/profile.php?id=10

    <?php
    echo $_GET['id'];
    ?>

    $_POST
    http://www.php.net/manual/en/reserved.variables.php

    Functions

    <?php
    function hello_world()
    {
        echo "Hello World";
    }

    hello_world();
    ?>

    Functions

    <?php
    function text($my_text)
    {
        echo $my_text;
    }

    text("Hello World");

    ?>

    Constants


    <?php
    define("CONST_NAME", "constant value");

    echo CONST_NAME;
    ?>

    Object Oriented

    <?php
    class Class_name {

         public $variable = "";
         
         public function change_variable($new_value){
              $this->variable = $new_value;
        }
    }

    $obj = new Class_name();
    $obj->change_variable("hello world");
    echo $obj->variable;
    ?>

    Frameworks


    • Codeigniter
    • Yii Framework
    • Wordpress
    • Laravel

    @sk Google " PHP Frameworks "

    Resources


    http://www.php.net/

    http://www.php.net/docs.php

    http://www.php.net/manual/en/index.php

    http://www.php.net/manual/en/funcref.php

    Any Questions ??




    Contact

    Hazem Noor

    hazemnoor@gmail.com

    Intro to php

    By Hazem Noor