Day 1 PHP Introduction

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 15

Day 1

PHP Introduction
Geshan Manandhar
Developer,
Young Innovations Pvt. Limited
www.geshanmanandhar.com

GeshanManandhar.com 1
What is PHP
► PHP, which stands for “PHP: Hypertext
Preprocessor”.
► PHP is a widely-used Open Source general-
purpose scripting language.
► It is especially suited for Web development
and can be embedded into HTML.
► It was originally created by Rasmus Lerdorf
in 1995.
GeshanManandhar.com 2
More About PHP
► PHP is free software released under the PHP
License.
► PHP typically runs on a web server that
takes PHP as input and gives out HTML
pages as output.
► PHP is installed on more than 20 million
websites and 1 million web servers.
► PHP has a syntax similar to C and Java.
► The current version of PHP is 5.2.x.
GeshanManandhar.com 3
Features of PHP
► Itis Free and Open
source.
► Easy to learn but hard
to master.
► Connects with 20+
databases.
► Version 5+ supports
OOP.
► Multi-platform
compatible.
GeshanManandhar.com 4
The LAMP Stack

► Apache is the web server.


► MYSQL is the database server.
► PHP is the backend coding language.
GeshanManandhar.com 5
PHP Trend

GeshanManandhar.com 6
What will you learn

GeshanManandhar.com 7
Software required to run PHP on
Windows
► XAMPP
 X- for all platforms (windows, linux…)
 A- Apache web server
 M- MYSQL with PHPMyAdmin
 P- PHP
 P- Perl
► That’s
all you need you must have good IDE
to code.
GeshanManandhar.com 8
IDEs for PHP development
► IDE – Integrated Development Environment
 Adobe Dreameweaver
 Notepad++
 Zend Development Studio
 PHP Eclipse

GeshanManandhar.com 9
Ways to code your PHP website or
web Application

Source: http://geshan.blogspot.com

GeshanManandhar.com 10
Basic PHP Program
► Helloworld
► X:\xampp\htdocs\my_folder\first_prog.php

<?php //starting delimeter


echo “Hello world”; //print hello world
?>

Add some complication:


<?php
$message = “Hello world”;
print $message;
GeshanManandhar.com 11
?>
Delimiter, tags and comments
► <?php //php code ?> - long tag
► <? ?> - short tag
► <% %> - ASP style not preferred
► <script language="php">
        //php tag
    </script> - uncommon
► <?= ?> - shortcut for echo
► //line comment
► /*
block comment
*/
GeshanManandhar.com 12
PHP Data Types
► Boolean
► Integer
► Float
► String
► Array
► Objects

GeshanManandhar.com 13
Another simple program
► Simple price calculation
<?php
$qty = 5;
$price = 10000;
$amt = $qty*$price;

echo “Rs. “.number_format($amt, 2);


?>
GeshanManandhar.com 14
Lets Install XAMPP
► Letsinstall XAMPP and run 2 programs
► Ask questions.

GeshanManandhar.com 15

You might also like