Introduction to PHP - WPI

Introduction To PHP WPI-ppt Download

  • Date:05 Aug 2020
  • Views:18
  • Downloads:0
  • Size:79.50 KB

Share Presentation : Introduction To PHP WPI

Download and Preview : Introduction To PHP WPI

Report CopyRight/DMCA Form For : Introduction To PHP WPI


Transcription:

PHP Scripting languageLudovico Antonio MuratoriCi S B i C sncCesena ITALY Introduction to PHP.
PHP is a server side scripting language designedspecifically for the Web Within an HTML page you canembed PHP code that will be executed each time the pageis visited Your PHP code is interpreted at the Web serverand generates HTML or other output that the visitor will.
see PHP and MySQL Web Development LukeWelling and Laura Thomson SAMS PHP History1994 Created by Rasmis Lesdorf software engineer partof Apache Team .
1995 Called Personal Home Page Tool then released asversion 2 with name PHP FI Form Interpreter to analyzeSQL queries Half 1997 used by 50 000 web sitesOctober 1998 used by 100 000 websites.
End 1999 used by 1 000 000 websites Alternatives to PHPPractical extraction and Report Language Perl Active Server Pages ASP Java server pages JSP .
Good Topics about PHPOpen sourceEasy to use C like and Perl like syntax Stable and fastMultiplatform.
Many databases supportMany common built in librariesPre installed in Linux distributions How PHP generatesHTML JS Web pages.
1 Client from browser send HTTP request with POST GETvariables 2 Apache recognizes that a PHP script is requested and sends therequest to PHP module3 PHP interpreter executes PHP script collects script output and.
sends it back4 Apache replies to client using the PHP script output as HTML Hello World web oriented title My personal Hello World PHP script title PHP tag allow to insert PHP.
echo Hello World code Interpretation by PHP module will substitute the code html with code output Variables I To use or assign variable must be present before the name of.
the variableThe assign operator is There is no need to declare the type of the variablethe current stored value produces an implicit type casting ofthe variable .
A variable can be used before to be assigned B 2 C A B Integer sum D A B String concatenationecho C prints 3.
echo D prints 12 Variables II Function isset tests if a variable is assigned or notif isset A print A isset .
if isset B print B is NOT set help hiddenVar help hidden Value echo help prints hidden Value.
help 10 help help help echo help print 100 Strings I A string is a sequence of chars.
stringTest this is a sequence of chars echo stringTest 0 output techo stringTest output this is a sequence of charsA single quoted strings is displayed as is age 37 .
stringTest I am age years old output I am age years old stringTest I am age years old output I am 37 years oldConcatenation conc is a composed string echo conc output is a composed string.
newConc Also conc conc echo newConc output Also conc is a composed string Strings II Explode function sequence A B C D E F G .
elements explode sequence Now elements is an array with all substrings between charecho elemets 0 output A echo elemets 1 output B echo elemets 2 output C .
echo elemets 3 output D echo elemets 4 output E echo elemets 5 output F echo elemets 6 output G Arrays I .
Groups a set of variables every element stored into an array asan associated key index to retrieve the element books array 0 php manual 1 perl manual 2 C manual books array 0 php manual perl manual C manual books array php manual perl manual C manual .
echo books 2 output C manualArrays with PHP are associative books array php manual 1 perl manual 1 C manual 1 HASHecho books perl manual output 1 books lisp manual 1 Add a new element.
Arrays II Working on an arrays books array php manual perl manual C manual Common loopfor i 0 i count books i .
print i 1 st book of my library books i books array php manual 1 perl manual 2 C manual 3 while item each books Retrieve items one by oneprint item value st book of my library item key each retrieve an array of two elements with key and value of current element.
each and listwhile list value key each books print value st book of my library key list collect the two element retrieved by each and store them in twodifferent variables.
Arrays III Multidimensional arrays books array array title php manual editor X author A array title perl manual editor Y author B array title C manual editor Z author C .
Common loopfor i 0 i count books i print i st book title books i title author books i author editor books i editor Add n for text new page or BR for HTML new page .
Use list and eachfor i 0 i count books i print i st book is while list key value each books i print key value .
print BR or n Case study small database I You need to build one or more web pages to manage your library but You have no time or no knoledge on how to plan and designdatabase .
or You have no time or knolwdge on how to install a freedatabase And The database to implement is small about fewthousands entries but depends on server configuration Case study small database II .
cat usr local myDatabaseDirectory... php manual X A 330perl manual Y B 540C manual Z C 480 fields separated by tabs php manual tab X tab A new line at the end of each.
script to show all book in my library books file usr local myDatabaseDirec... retrieve library database for i 0 i count books i books array i explode t books i Extract elements from linefor i 0 i count books array i .
print i st book title books array i title author books array i author editor books array i editor BR Case studyA way to reuse code I Using functions is possible to write more general code to allow us to reuse.
it to add feature For the same project always try to write reusable code also youwill work for a short time on a project For new projects config php is a good idea to use configuration files.
tableFiles array books usr local myDatabaseDir... bookTableFields array title author editor pages future development of the library project add new tables tableFiles array users usr local myDatabaseDir... userTableFields array code firstName lastName age i... .
Case studyA way to reuse code II script to show all book in my library books file usr local myDatabaseDirec... retrieve library database .
for i 0 i count books i books array i explode t books i Extract elements from linefor i 0 i count books array i print i st book title books array i title author books array i author .
editor books array i editor BR Functions in details I The syntax to implement a user definedfunction is function function name parameters list ... .
implementation code parameters list is a sequence of variables separated by it s not allowed to overload the name of an existing function Function names aren t case sensitive To each parameter can be assigned a default value .
arguments can be passed by value or by referenceIt s possible using a variable number of parameters Object Oriented PHPEncapsulationPolymorphism.
InheritanceMultiple Inheritance actually unsupported Encapsulation val4 month 1 3 5 class dayOfWeek .
val5 year 4 var day month year val6 year 100 function dayOfWeek day month year val7 year 400 .
this day day val8 day month 2 val4 val3 val5 va... this month month val9 val8 7 this year year .
val0 val8 val9 7 return val0 function calculate if this month 1 monthTmp 13 .
yearTmp this year 1 instance new dayOfWeek GET day GET week GET... if this month 2 month monthTmp 14 print You born on instance calculate n .
yearTmp this year 1 InheritanceAllow the creation of a hierarchy of classesClass reuseMe reuseMe Class extends reuseMe .
function function example doTask1 local initializations call super constructorfunction reuseMe reuseMe doTask2 .
function function doTask4 doTask3 function doTask5 function doTask6 Polymorphism.
A member function can override superclassimplementation Allow each subclass toreimplement a common interfaces class reuseMe function reuseMe Class extends reuseMe .
function example function doTask1 local initializations call super constructorreuseMe reuseMe function doTask2 .
function doTask4 function doTask3 function doTask5 function doTask6 function doTask3 .
Multiple Inheritance not actually supported byclass reuseMe1 class reuseMe2 function reuseMe1 function reuseMe2 function doTask1 function doTask3 function doTask2 function doTask4 .
function doTask3 function doTask5 class extends reuseMe1 reuseMe2 Bibliography 1 PHP and MySQL Web Development Luke Welling and LauraThomson SA.
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 executed each time the page is visited. Your PHP code is interpreted at the Web server and generates HTML or other output that the visitor will see” (“PHP and MySQL Web Development ...

Related Presentations

Introduction WPI

Project Assignment Virtual Machines Introduction to Concurrency Why an Operating Systems course? ... Exams and Quizzes Mid-term exam approx February 1 Final exam, February 26, 8:00 AM Exam rules One hour May include lecture material introduced earlier that same class Closed book, one 8½ x 11 sheet of prepared notes (2 sides) Bring calculator ...

26 Views0 Downloads

Week 0 Introduction WPI

~4 Programming Projects 1week each except last one Mobile Phones, pagers and other similar devices OFF during class Avoid food and drink in class Office Hours by appointment or immediately after class Fridays noon–1:00PM Contacts <Professor’s last name> @ cs.wpi.edu Fuller 144:– (508) 831-5493 Class e-mail lists cs3013-all or cs3013-staff ...

21 Views0 Downloads

Introduction Academics WPI

A data mining approach to developing the profiles of hotel customers. International . Journal of Contemporary . Hospitality Management, 14 (6), 274–285. Savasere, A., Omiecinski, E., & Navathe, S. (1998). Mining for strong negative associations in a large database of customer transactions. ... Travel is primarily viewed as a luxury product ...

19 Views0 Downloads

Introduction to Classes in C WPI

Introduction to Classes and Objects CS-2303 System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition, by Kernighan and Ritchie and from C: How to Program, 5th and 6th editions, by Deitel and Deitel)

10 Views0 Downloads

Introduction to Database Systems WPI

Introduction to Database Systems Subject: Database Management Systems Author: Raghu Ramakrishnan and Johannes Gehrke Keywords: Chapter 1 Description: See the notes for information on how the slides are organized. Last modified by: default Created Date: 1/6/1997 6:13:42 PM Document presentation format: On-screen Show (4:3) Other titles

11 Views0 Downloads

PHP An Introduction

service support education extensions open source companies IBM uses and develops Apache and Linux; created Secure Mailer and created other software on AlphaWorks Apple released core layers of Mac OS X Server as an open source BSD operating system called Darwin; open sourcing the QuickTime Streaming Server and the OpenPlay network gaming toolkit ...

34 Views0 Downloads

Introduction to PHP

Data Types (1) PHP has eight different data types – 5 basic and 2 composite types and 1 resource type. The 5 basic data types are: integers: whole numbers in the range -2,147,483,648 to +2,147,483,647 on 32-bit architecture.

27 Views0 Downloads

Introduction to PHP Chakarov

PHP: Introduction By Trevor Adams Topics Covered Server side web programming Client/Server systems Comparison with static HTML PHP - what is it? What does it do? PHP Language basics Syntax Variables, Constants, Operators Decision making PHP and the client Client/Server on the WWW Standard web sites operate on a request/response basis A user ...

17 Views0 Downloads

Introduction to PHP University of Michigan

Introduction to PHP Dr. Charles Severance www.php-intro.com Note from Chuck. If you are using these materials, you can remove my name and URL from this replace it with your own, but please retain the CC-BY logo on the first page as well as retain the entire last page when you remix and republish these slides.

9 Views0 Downloads

Introduction to PHP instesre org

Introduction to PHP – Chapter 8 Working with PHP JavaScript vs. PHP PHP scripts are similar to JavaScript scripts, but be careful with syntax! PHP variables always begin with a “$” symbol. There is no equivalent to JavaScript’s “var” data declaration. PHP scripts are embedded within a <?php … ?> tag.

7 Views0 Downloads

Introduction to PHP Mahasarakham University

Web Development. FINAL 50%. Week5-6. Web Services. XML. Web Service Client. Web Service Server. Web2.0 Mashup. Week7. PHP template with Smarty

12 Views0 Downloads

Introduction to PHP WA4E

Introduction to PHP Last modified by: Sue Blumenberg Document presentation format: On-screen Show (16:9) Other titles: Helvetica MS Pゴシック Arial Gill Sans Lucida Grande ヒラギノ角ゴ ProN W3 Courier 1_Office Theme Office Theme PHP Arrays PHP Arrays Rock! Associative Arrays Integer Indices Key / Value Dumping an Array var_dump vs ...

15 Views0 Downloads