PHP: The easiest language to learn.

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    PHP: The easiest language to learn. - Presentation Transcript

    1. PHP
      • The easiest language to learn.
      • By Binny V A
      • http://www.bin-co.com/php/
    2. PHP P HP: H ypertext P reprocessor PHP: Hypertext Preprocessor PHP: Hypertext Preprocessor PHP: Hypertext Preprocessor PHP: ... Like GNU.
    3. Its Easy – but Hard
      • To use PHP, you must know...
      • HTML
      • SQL
      • CSS
      • JavaScript
      • Web Server(Apache) Configuration
      • Database Server(MySQL) Configuration
    4. LAMP Linux/Apache/MySQL/PHP
    5. Hello World!
      • <?php
      • print “Hello World”;
      • ?>
      • php file.php
      • firefox http://localhost/file.php
    6. Variables $ Prefix for variables $name = 'ILUG' ; // String $year = 2008 ; // Number $is_php_good = true ; // Boolean // is a comment – as is /* to */ - PHP follows the C Syntax
    7. Arrays/Hashes $arr = array(“Indian”, “Linux”, “User”, “Group”); $arr[1] = 'Libre'; print $arr[1]; $details = array( “abbr” => “ILUG”, “full” => “Indian Libre User Group” ); print $details['full'];
    8. Operators
      • + 5+2 Plus
      • - 5-2 Minus
      • *
      • /
      • == 1 == true
      • === 1 !== true
      • !=
      • % Mod
      • = $a = 5
      • . “hel” . “lo”
      • etc.
    9. Control Flow: if If if($name == 'Binny') { print “Hi, Binny”; } elseif($name == 'Sameer') { print “Hello Sameer”; } else { print “Hello everybody”; }
    10. For/Foreach For $languages = array('PHP', 'Ruby', 'JavaScript', 'Python', 'Perl', 'Tcl'); for($i =0; $i < count($languages); $i++) { print $i+1 . “) “ . $languages[$i]; } Foreach foreach($languages as $lang) { print $lang; }
    11. While Loop $i = 1; While($i < 10) { print $i; $i++; }
    12. Functions function hello($name) { print “Hello, $name.”; } hello(“World”);
    13. OOPs and PHP
      • PHP 5 has all the most necessary OOPs features...
      • Constructors/Destructors
      • Visibility (public, private, protected)
      • Static Methods/Variables
      • Abstraction
      • Inheritance
      • And more...
    14. Class class Movie { public $name; function __construct($movie_name) { $this->name = $movie_name; } function show() { print $this->name; } } $film = new Movie(“City of God”); $film->show();
    15. Getting Help PHP Manual(CHM) Install KCHM to view it.
    16. Functions
      • String Functions
      • strtolower() / strtoupper()
      • str_replace()
      • strpos()
      • Array Functions
      • array()
      • count()
      • array_push()
      • array_splice()
      • ...
    17. Database
      • MySQL must be installed and running.
      • Need Information about...
      • server(usually 'localhost')
      • username
      • password
      • database
    18. Connection mysql_connect('localhost', 'root', 'password'); mysql_select_db('database_name'); Use a database abstraction layer. $db = new Sql(“localhost”, 'root', 'password', 'database_name');
    19. Executing Queries $sql_handle = mysql_query(“SELECT id,name FROM users WHERE status='1'”) or die(mysql_error()); $result = mysql_fetch_assoc($sql_handle); print $result['name'];
    20. Fetching Result while($result = mysql_fetch_assoc($sql_handle)) { print $result['name']; } Use Database Abstraction layer!
    21. PHP and the Web Embedding PHP... <strong><?php print hello($name) ?></strong>
    22. Form Submission <form action=”action.php” method=”post”> Age: <input type=”text” name=”age” /> <input type=”submit” name=”action” value=”Save” /> </form>
    23. action.php if($_POST['action'] == 'Save') { print $_POST['age']; }
    24. Frameworks
      • Zend
      • CodeIgnite
      • CakePHP
      • Symphony
      • And more..
    25. Free Software
      • CMS Tools
        • WordPress
        • Drupal
        • Joomla/Mambo
      • Forum
        • phpBB
        • BbPress
      • Shopping Cart
      • Wiki
    26. Credits Getting Help: http://www.flickr.com/photos/doctorow/2496308570/ MySql: http://www.flickr.com/photos/johnniewalker/359440369/ Framework Image : http://www.sxc.hu/photo/916787 Free Software: http://www.flickr.com/photos/marcomolinari_it/2474783234/

    + Binny V ABinny V A, 11 months ago

    custom

    1053 views, 1 favs, 0 embeds more stats

    A basic introduction to PHP

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1053
      • 1053 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 72
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories