Wednesday, December 14, 2016

use php - what is php & Easy Tutorials learn

Define PHP Simple understand & Easy Tutorials learn

 what is php
   . PHP stand for “Hypertext Pre processor”
   . Rasmus Lerdorf is known as the father of P H P (1994)
   . The old name of P H P is “Personal Home Page”
   .  Personal Home page is a software tool which is written in C programming language, this tool is        used for tacking online visits resume
   . Rasmus Lerdorf study on this tool and rewrote same tool with richer implementation
   . In 1994 he produces this model with name “Hypertext Pre processor” and its acronym is P H P.
    .In that time P H P is able to integrate with Database and build dynamic web application.
   . In June 1995 Rasmus Lerdorf released the source code for P H P Tools to the developers for testing.
   . In April 1996 introduced P H P.F I (Forms Interpreter) this is enhancement of past model, then time  to   time they released some other source codes for P H P
    .In 20 Oct 1999 Rasmus Lerdorf with his team released First version known as P H P 3
     . P H P is used to develop dynamic web application 
    .P H P is server side Script language
    .Through this Server side Script language, we will develop dynamic web application, managing the .dynamic content, databases etc.
    .P H P is easy to use, it will be easily embedded in HTML. 
 what is php & Easy Tutorials

Version

Version
Released Date
PHP 3
20 Oct 1999
PHP 4
22 May 2000
PHP 5
13 July 2004
PHP 7
03 Dec 2015

These version contains sub versions for more details please visit P H P official website
http://teachmeprograme.blogspot.com

Environment Setup


P H P is most popular server side script language which is used to create dynamics web pages or applications, in this section you will learn that how to create dynamics web pages or applications using P H P. As I’m suggesting you before start PHP web development you will have complete knowledge of HTML, C.S.S and JAVA SCRIPT so that P H P development will become easy for you to learn. use php

As we know P H P is a server side script language so to execute any P H P program you need web Server, so I’m going to recommend you following programs, install in your local machine and access the P H P environment .use php & Easy Tutorials

·         The Apache Server (http://httpd.apache.org/download.cgi)
·         The MySQL Database Server (http://www.mysql.com/downloads/)

Install above two program in your local machine then you will be able to execute any P H P program. There are also other ways to access P H P environment in your local machine, I’m going to recommended some of them

·         XAMPP server (https://www.apachefriends.org/index.html)
·         WAMP server (http://www.wampserver.com/en/)

XAMPP and WAMP both are web servers; their job is to get web development environment in your local machine. Both are allowing you to create dynamic web application using PHP. Both server contains Apache server, PHP and MySQL database and both servers provide you MySQL database administrative tool which is Php My Admin. PhpMyAdmin will help you to manage your databases using web browser.

what is php & Easy Tutorials

So I’m preferring you to install XAMPP or WAMP server in your local machine rather than install individually Apache server and MySQL database in your local machine. Once you successfully install XAMPP or WAMP server in your local machine then a shortcut of respected server will be created on your desktop, as I installed XAMPP server on my local machine so I double click on XAMPP server control panel shortcut it will look like this:

Start Apache and MySQL
what is php & Easy Tutorials

PHP first Program


Assume you install XAMPP server in E Drive then go to E Drive > xampp > htdocs
Like that:             E:\xampp\htdocs

Htdocs is your main directory where you will create all your PHP dynamic web projects so inside this folder create new folder, then gives suitable name to that folder as you want as for my concerned I’m giving the name “phpdemo” to my folder.

Inside this (phpdemo) folder I’m creating a file with name hello.php

·         Note: (hello is the name of my file and .php is then extension of PHP file)
·         Tip: (whenever you create any PHP file, whatever the name you given but in last you must give the .php extension).
      use php - what is php

Now my directory looks like this:
·         E:\xampp\htdocs\phpdemo\hello.php
·         E drive > xampp > htdocs > phpdemo > hello.php

URL:       http://localhost/
Now this URL directly access your htdocs folder so now type folder name you create inside the htdocs folder as I created “phpdemo” folder so I’m write phpdemo after localhost so my project URL Look like this
URL:       http://localhost/phpdemo
what is php & Easy Tutorials



This project directory will display you all your project files and holders which you will create as for now we create just one file with “hello.php” so it displays the same file now click on “hello.php”, then output will look like this:

Now as you notice nothing is display because we just create file not write any piece of code, so now go to any text editor as you feel comfortable with that and type that code as you shown in below image

Now save your file and refresh the browser

PHP syntext

Syntax
·         Syntax                  <?php….?>
·         you can write PHP code between <?php and  ?>
·         you can write PHP script anywhere in the php file as you want
·         you can also write HTML code inside the PHP file


·         everything inside the PHP script is known as statements, every statements will end with semicolon (;)

PHP Comments
o   Comments are used to provide description of respected statements
o   Comments are not read by server
o   Single Line Comment
§  Double slash “//” is used for single line comment
§  Hash “#” is used for single line comment
o   Multi Line Comment
§  “/*….. */” is used for multi-line comments
·         PHP is Case sensitive only with VARAIBLES
·         PHP is not case sensitive with all keywords, classes, functions etc
·         Below I’m giving you example which is related to Comments and Case sensitivity

Note: in output it shows error on line number 26 and 29 that Undefined variables so if we look at the code I just create one variable “$color”, in echo statements I writes $color, $COLOR and $CoLoR so from this it’s clear variable are case sensitive and other thing except variable are not case sensitiveso if you look at echo statement I write echo in three different ways i.e. (echo, ECHO, EcHo) but output is same.
use php - what is php what is php & Easy Tutorials

No comments:

Post a Comment