Introduction to PHP SOFTWARE FREEDOM DAY1 Introduction to PHP MS. SADAF ABBASI

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
1 Database Driven Web Application Clients Application Servers including web servers Database Server Traditional client-server (2-tier architecture): client:
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
BY: ALBERTO CABEZAS 4/19/2010. INTRODUCTION: PHP is considered today as one of the most famous scripting languages. PHP is widely used as a general purpose.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Server Side Web Technologies: Part 2.
Copyright 2009 Justin C. Klein Keane PHP Code Auditing Session 1 – PHP Foundations Justin C. Klein Keane
Introduction to PHP (Part-1) Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
Server & Client  Client: Your computer  Server: Powerful & Expensive computer. Requires network access.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
WHAT IS PHP PHP is an HTML-embedded scripting language primarily used for dynamic Web applications.
PHP By Dr. Syed Noman Hasany. PHP PHP was originally created by Rasmus Lerdorf in PHP stands for PHP: Hypertext Preprocessor (a recursive acronym).
PHP and MySQL Week#1  Course Plan.  Introduction to Dynamic Web Content.  Setting Up Development Server Eng. Mohamed Ahmed Black 1.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
COMP An Introduction to Computer Programming : University of the West Indies COMP6015 An Introduction to Computer Programming Lecture 03.
August Chapter 1 - Essential PHP spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
PHP HYPERTEXT: PREPROCESSOR By: Justin T. Pleva. WHAT IS PHP?  General purpose  Server-side web development  Console application.
ITD 3194 Web Application Development Chapter 4: Web Programming Language.
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
INTERNET APPLICATION DEVELOPMENT For More visit:
PHP TUTORIAL. HISTORY OF PHP  PHP as it's known today is actually the successor to a product named PHP/FI.  Created in 1994 by Rasmus Lerdorf, the very.
School of Computing and Information Systems CS 371 Web Application Programming PHP - Basics Serving up web pages.
Nael Alian Introduction to PHP
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
Server & Client  Client: Your computer  Server: Powerful & Expensive computer. Requires network access.
November 2003Bent Thomsen - FIT 6-11 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Introduction to PHP “PHP is a server-side scripting language designed specifically for the Web. Within an HTML page, you can embed PHP code that will be.
Introduction to PHP A user navigates in her browser to a page that ends with a.php extension The request is sent to a web server, which directs the request.
Open Source Software Unit – 3 Presented By Mr. R.Aravindhan.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
1 Graphics CSCI 343, Fall 2015 Lecture 2 Introduction to HTML, JavaScript and WebGL.
CS320 Web and Internet Programming Introduction to PHP Chengyu Sun California State University, Los Angeles.
PHP. What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
Introduction to PHP Advanced Database System Lab no.1.
What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports.
CSE 154 LECTURE 5: INTRO TO PHP. URLs and web servers usually when you type a URL in your browser: your computer looks up the.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
IT ELECTIVE 2.  Web server Can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver content that.
CHAPTER 6 Introduction to PHP5 Part I อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
1) PHP – Personal Home Page Scripting Language 2) JavaScript.
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
CSE3310: Web training A JumpStart for Project. Outline Introduction to Website development Web Development Languages How to build simple Pages in PHP.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
First Steps in PHP Creating Very Simple PHP Scripts SoftUni Team Technical Trainers Software University
Introduction to PHP. PHP Origins Rasmus LerdorfRasmus Lerdorf (born Greenland, ed Canada) PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP.
PHP Basics and Syntax Lesson 3 ITBS2203 E-Commerce for IT.
PHP using MySQL Database for Web Development (part II)
PHP for Server-Side Programming
Introduction to Dynamic Web Programming
CS 371 Web Application Programming
Introduction to PHP “PHP is a server-side scripting language designed specifically for the Web. Within an HTML page, you can embed PHP code that will be.
Introduction to PHP “PHP is a server-side scripting language designed specifically for the Web. Within an HTML page, you can embed PHP code that will be.
PHP Introduction.
PHP.
Maged Bouchahma University of Nizwa
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
IntroductionToPHP Static vs. Dynamic websites
Intro to PHP.
PHP an introduction.
23 PHP.
Web Application Development Using PHP
Presentation transcript:

Introduction to PHP SOFTWARE FREEDOM DAY1 Introduction to PHP MS. SADAF ABBASI

Introduction to PHP SOFTWARE FREEDOM DAY2 Introduction to PHP PHP Hypertext Preprocessor. –Other Names : Personal Home Page, Professional Home Page Is a server side scripting language. –Capable of generating the HTML pages HTML generates the web page with the static text and images. However the need evolved for dynamic web based application, mostly involving database usage.

Introduction to PHP SOFTWARE FREEDOM DAY3 CLIENT WEB SERVER HTTP Request (url) Gets Page Hello Interprets the PHP code Server response Browser creates the web page Hello

Introduction to PHP SOFTWARE FREEDOM DAY4 Why PHP?..there are no. of server side scripting available like ASP, SSJS, JSP….. PHP involves –simplicity in scripting (..generally using the database) –platform independence. PHP is –primarily designed for web applications –well optimized for the response times needed for web applications Is an open source.

Introduction to PHP SOFTWARE FREEDOM DAY5 PHP Language features PHP language features such as control structures, operators, variable types, function declaration, class/object declaration are almost similar to any compiled or interpreted language such as C or C++.

Introduction to PHP Features of PHP It is Free and Open source. Easy to learn but hard to master. Connects with 20+ databases. Version 5+ supports OOP. Multi-platform compatible. SOFTWARE FREEDOM DAY6

Introduction to PHP The WAMP/LAMP Stack SOFTWARE FREEDOM DAY7 Apache is the web server. MYSQL is the database server. PHP is the backend coding language.

Introduction to PHP IDEs for PHP development IDE – Integrated Development Environment –Adobe Dreameweaver –Notepad++ –Dev-PHP –Zend Development Studio –PHP Eclipse SOFTWARE FREEDOM DAY8

Introduction to PHP PHP Trend SOFTWARE FREEDOM DAY9

Introduction to PHP SOFTWARE FREEDOM DAY10 PHP Data Type Three basic data types –Integer –Double –String More data types –Array –Object PHP is an untyped language –variables type can change on the fly.

Introduction to PHP SOFTWARE FREEDOM DAY 11 PHP Block PHP code block is embedded within the tags. When the server encounters the PHP tags it switches from the HTML to PHP mode. There are four different ways to embed the PHP code – – echo(“Some PHP code”); –

Introduction to PHP SOFTWARE FREEDOM DAY12 PHP Constants..values that never changes Constants are defined in PHP by using the define() function. –For e.g. define(“NCST”, “ National Centre for Software Technology ”) defined() function says whether the constant exists or not.

Introduction to PHP SOFTWARE FREEDOM DAY13 PHP Variables The variables in PHP are declared by appending the $ sign to the variable name. –For e.g $company = “NCST”; $sum = 10.0; variable’s data type is changed by the value that is assigned to the variable. Type casting allows to change the data type explicitly.

Introduction to PHP SOFTWARE FREEDOM DAY14 PHP Variables (cont.) Rich set of functions for working with variable. –For e.g gettype, settype, isset, unset, is_int, intval etc etc

Introduction to PHP SOFTWARE FREEDOM DAY15 PHP Operators All the operators such as arithmetic, assignment, Comparison, and logical operators are similar to the operators in C and C++. In PHP the string concatenation operator is denoted by ‘.’. –For e.g. $name = “My name is”.$myname;

Introduction to PHP SOFTWARE FREEDOM DAY16 PHP Statements IF statement if ( ) { //php code goes here } else { //php code goes here } Alternative Syntax if( ) : //html code goes here else : //html code goes here endif;

Introduction to PHP SOFTWARE FREEDOM DAY17 PHP Statements (cont.) For loop for($i=0;$i < 10;$++i) { echo(“the value is :”. $i); } –Alternative Syntax for($i=0;$i < 10;$++i) : // html code goes here endfor; While loop Do-While loop

Introduction to PHP SOFTWARE FREEDOM DAY18 Functions Function declaration in PHP function my_func( ) { //do something in the function } –for e.g. function sayHello() { echo(“ hello amrish ”); }

Introduction to PHP SOFTWARE FREEDOM DAY19 Functions (cont.) Assigning functions to the variables –for e.g $hello = “my_func”; to invoke the function my_func() through the variable $hello( ); When an argument is to be passed by reference, an ampersand (&) is placed before the parameter name –for e.g. my_func(&$my_refvar);

Introduction to PHP SOFTWARE FREEDOM DAY20 Arrays..contains value set each element has a value, data stored in the element. And has a key by which the element can be referred to.

Introduction to PHP SOFTWARE FREEDOM DAY21 Initializing Arrays No of ways to initialize the array. –For e.g. $ncststaff[] = “amrish”; $ncststaff[] = “murali”; $ncststaff[] = “narayan”; $ncststaff[123] = “amrish”; $ncststaff[122] = “murali”; $ncststaff[121] = “narayan”; $ncststaff = array (“amrish”, “murali”, “narayan”); –to change the indices of the array use => operator.

Introduction to PHP SOFTWARE FREEDOM DAY22 Accessing the Array Elements The elements in the array can be accessed by using the list and each constructs –for e.g while(list($key,$value) = each(countries)) echo(“$value \n”); –current( ) gives the current value being accessed. key( ) gives the index of the current element that is being accessed. –prev( ) gives the previous element. –next( ) gives the next element.

Introduction to PHP SOFTWARE FREEDOM DAY23 Accessing the Array Elements (cont.) –Array_walk(, ) function_name is the function that is written for every member of an array. For e.g $ncststaff = array (“amrish”, “murali”, “narayan”); array_walk ($ncststaff, printstaff); // function to print each element of the array function printstaff($names) { echo “ $names \n”; }

Introduction to PHP SOFTWARE FREEDOM DAY24 Arrays (cont.) $ncststaff = array (“dake” => array(“amrish”, “lakshana”, “venkat”), “spc” => array(“narayan”, “murali”,“prasad”)); –creates a two dimensional array. Sorting Functions –sort() : sorts the elements in the numeric and alphabetical order. –rsort() : sorts the elements in the reverse order. –asort() : sorts the elements in the array without changing the indices. –ksort() : sorts the arrays by key.

Introduction to PHP SOFTWARE FREEDOM DAY25 Classes Class is a template of an object and includes the properties and methods that describe an object and behavior. Class in PHP is defined using class statement.

Introduction to PHP SOFTWARE FREEDOM DAY26 Classes (cont.) For e.g <? class company { // define the properties var $companyname; // define the methods function company($cname) { $this->companyname = $cname; } function getnames($idcode) { //return the name of the employee for the required idcode } ?>

Introduction to PHP SOFTWARE FREEDOM DAY27 PHP Richness PHP comes with myriad of options i.e. supports several APIs and interfaces to other programming tools such as –Database connectivity. –XML –Mail protocols such as IMAP, SMTP –Image functions etc….

Introduction to PHP A. SOFTWARE FREEDOM DAY28 Image Generation & Manipulation PHP offers powerful set of functions for generating and manipulating the images. –Rendering regular geometric figures, modifying images –manipulate text, font and color and even the pixels in the image. ….creating the images on the fly.

Introduction to PHP SOFTWARE FREEDOM DAY29 Image Generation & Manipulation (cont.) PHP uses the GD library for the most of the image functionality that it offers. GD library is used for generating the two-dimensional graphics. PHP API’s provides us with functions to: –Create, delete, resize and modify images. –Draw basic geometric figures –Manipulate text and fonts –Manipulate colors –Interlace and manipulate pixels –Handle PostScript files

Introduction to PHP SOFTWARE FREEDOM DAY30 Mailing functions Sending s –Mail() Used to send simple text messages. Depends on the local mail delivery system. –Using SMTP Accepts the for every recipient and goes through trouble of delivering the s. Receiving s –PHP works out well with the IMAP protocol. –Rich set of support functions Imap_open, impa_delete, imap_close, imap_mail_copy, imap_mail_move etc.

Introduction to PHP SOFTWARE FREEDOM DAY31 PHP-Database Connectivity Supports APIs for accessing large number of databases. ODBC is a standard API for accessing a database that has PHP support.

Introduction to PHP SOFTWARE FREEDOM DAY32 PHP-Database Operations Some of operations. –Insert Data –Delete Data –Search Data –Update Data

Introduction to PHP SOFTWARE FREEDOM DAY33 XML Support in PHP PHP supports a set of functions that can be used for writing PHP-based XML applications. These functions are used for parsing well formed XML document.

Introduction to PHP SOFTWARE FREEDOM DAY34 References Professional PHP programming –By Jesus Castagnetto, Chris Schollo et al

Introduction to PHP SOFTWARE FREEDOM DAY35 THANK YOU