Top Banner
1 Introduction to PHP 5 Introduction to PHP 5 Presented by Brett Buddin
21

1Introduction to PHP 5 Presented by Brett Buddin.

Jan 17, 2018

Download

Documents

3Introduction to PHP 5
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1Introduction to PHP 5 Presented by Brett Buddin.

1 Introduction to PHP 5

Introduction to PHP 5

Presented by Brett Buddin

Page 2: 1Introduction to PHP 5 Presented by Brett Buddin.

2 Introduction to PHP 5

What is PHP?

“PHP: Hypertext Preprocessor”• General purpose scripting language

• Most commonly used for server-side scripting

Page 3: 1Introduction to PHP 5 Presented by Brett Buddin.

3 Introduction to PHP 5

Page 4: 1Introduction to PHP 5 Presented by Brett Buddin.

4 Introduction to PHP 5

Why use PHP?

• Simple syntax

• Easy to learn

• Great performance

• Fantastic online documentation

• Open Source

Page 5: 1Introduction to PHP 5 Presented by Brett Buddin.

5 Introduction to PHP 5

History

• Initially released in June 1995 by Rasmus Lerdorf as “Personal Home Page Tools”

• Lerdorf merged PHP with his Form Interpreter to create PHP/FI

• Zeev Suraski and Andi Gutmans rewrote the parser to form the core of PHP 3

Page 6: 1Introduction to PHP 5 Presented by Brett Buddin.

6 Introduction to PHP 5

History

• PHP 4 released in May 2000

• PHP 5 released in July 2004

• Today powers millions of applications

Page 7: 1Introduction to PHP 5 Presented by Brett Buddin.

7 Introduction to PHP 5

Growth of PHP

Source: Netcraft

Page 8: 1Introduction to PHP 5 Presented by Brett Buddin.

8 Introduction to PHP 5

New in PHP 5

• Completely rewritten object model

• Interoperable XML tools

• MySQLi extension

• SQLite embedded

• Exception handling

Page 9: 1Introduction to PHP 5 Presented by Brett Buddin.

9 Introduction to PHP 5

Objects in PHP 3 and 4

• Treated as primitive data types

• Assigned and passed by value

• Had to manually force pass by reference

Page 10: 1Introduction to PHP 5 Presented by Brett Buddin.

10 Introduction to PHP 5

Objects in PHP 5

• Woven into the core

• Assigned and passed by handle

• This eliminates a lot of ampersands

Page 11: 1Introduction to PHP 5 Presented by Brett Buddin.

11 Introduction to PHP 5

Rewritten object model

• Interfaces and Abstract classes

• Class type hints

• Static keyword

• Final keyword

Page 12: 1Introduction to PHP 5 Presented by Brett Buddin.

12 Introduction to PHP 5

Rewritten object model

• Cloning

• Constructors and destructors

• Access modifiers

Page 13: 1Introduction to PHP 5 Presented by Brett Buddin.

13 Introduction to PHP 5

Cloning

• __clone() method

• Offers a way to create a copy of an object

Page 14: 1Introduction to PHP 5 Presented by Brett Buddin.

14 Introduction to PHP 5

Constructors and Destructors

• __construct() and __destruct() methods added

• Old constructor syntax still works

Page 15: 1Introduction to PHP 5 Presented by Brett Buddin.

15 Introduction to PHP 5

Access modifiers

• Access modifiers added for properties and methods

• The three P’s:– Public: All scopes have access

– Private: Only local object has access

– Protected: Only local and derived objects have access

Page 16: 1Introduction to PHP 5 Presented by Brett Buddin.

16 Introduction to PHP 5

Interoperable XML tools

• Standardized on libxml2• Extensions work together as a whole

• W3C specification compliant

• Very efficient

Page 17: 1Introduction to PHP 5 Presented by Brett Buddin.

17 Introduction to PHP 5

MySQLi Extension

• Prepared statements

• Bound input and output parameters

• SSL connections

• Multi-query functions

Page 18: 1Introduction to PHP 5 Presented by Brett Buddin.

18 Introduction to PHP 5

SQLite embedded

• No need for flat file databases

• SQLite supports– Transactions

– Subqueries

– Triggers

Page 19: 1Introduction to PHP 5 Presented by Brett Buddin.

19 Introduction to PHP 5

Exception handling

• Eliminates the need to check return values for every function

• Separation of business logic and error logic

Page 20: 1Introduction to PHP 5 Presented by Brett Buddin.

20 Introduction to PHP 5

PHP’s drawbacks

• Lack of language design

• Inconsistent naming conventions and function behavior

• Almost too popular

Page 21: 1Introduction to PHP 5 Presented by Brett Buddin.

21 Introduction to PHP 5

Questions?