PHP: Hypertext Preprocessor

33
PHP: Hypertext Preprocessor Stephen Corcoran April 9, 2013

description

PHP: Hypertext Preprocessor. Stephen Corcoran April 9, 2013. Overview. History Frameworks & Libraries Object-Oriented PHP Advance Techniques & Classes Future Demo Questions?. History. Rasmus Lerdorf CGI Scripts in Perl Rewritten in C for better performance PHP/FI & PHPTools - PowerPoint PPT Presentation

Transcript of PHP: Hypertext Preprocessor

Page 1: PHP: Hypertext Preprocessor

PHP: Hypertext PreprocessorStephen Corcoran

April 9, 2013

Page 2: PHP: Hypertext Preprocessor

Overview

History Frameworks & Libraries Object-Oriented PHP Advance Techniques & Classes Future Demo Questions?

Page 3: PHP: Hypertext Preprocessor

History

Rasmus Lerdorf

CGI Scripts in Perl

Rewritten in C for better performance

PHP/FI & PHPTools

1995 Release date

Page 4: PHP: Hypertext Preprocessor

History

Andi Gutmans & Zeev Suraski

1997 PHP 3

1999 Zend Engine

2000 PHP 4

Page 5: PHP: Hypertext Preprocessor

Frameworks

Yii

CodeIgniter

CakePHP

Zend

Symfony

Page 7: PHP: Hypertext Preprocessor

Package & Libraries

Pear› PHP Extension and Application Repository› http://pear.php.net/ › Web forms, form validation, xml parsers

cURL› Client URLs› libcurl (http://curl.haxx.se/libcurl/)› http, https, ftp, telnet, ldap

Page 8: PHP: Hypertext Preprocessor

Object-Oriented

Variable declaration

Object Cloning

User-Level Overloading

Typecasting

Page 9: PHP: Hypertext Preprocessor

Variables

Constants

Define

Global

Page 10: PHP: Hypertext Preprocessor

Constants

Page 11: PHP: Hypertext Preprocessor

Define

Page 12: PHP: Hypertext Preprocessor

Global

Page 13: PHP: Hypertext Preprocessor

Object Cloning

http://pastie.org/private/gtpmhllr0c3hw71x4d0ea

Page 14: PHP: Hypertext Preprocessor

Object Cloning

Page 15: PHP: Hypertext Preprocessor

User-level Overloading

__get()› Utilized for reading data from inaccessible properties

__set()› Utilized for writing data to inaccessible properties

__call() __callStatic() __construct() __destruct()

http://php.net/manual/en/language.oop5.overloading.php

Page 16: PHP: Hypertext Preprocessor

Typecasting

settype() gettype()

Page 17: PHP: Hypertext Preprocessor

Advanced Techniques & Classes

PHP CLI

SSH

Mail

Sessions & Cookies

Page 18: PHP: Hypertext Preprocessor

PHP CLI

#!/usr/bin/php

Scheduled/ing tasks

Multithreading

Stdin, Stdout, stderr

Page 19: PHP: Hypertext Preprocessor

PHP CLI

Page 20: PHP: Hypertext Preprocessor

SSH

ssh2_connect() ssh2_execute() ssh2_fingerprint() ssh2_auth_password(), pubkey_file(),

none() ssh2_tunnel() ssh2_mkdir(), rmdir(), chmod(), unlink()

Page 22: PHP: Hypertext Preprocessor

Mail

mail($to, $subject, $message, $headers)

$to -> user@domain $subject -> ‘Subject’ $message -> ‘Message body’ $headers -> From, BCC, CC, Reply-To

Page 23: PHP: Hypertext Preprocessor

Mail

Page 24: PHP: Hypertext Preprocessor

Sessions

start_session()

session_destroy()

$_SESSION[]

Page 25: PHP: Hypertext Preprocessor

Sessions

Page 26: PHP: Hypertext Preprocessor

Cookies

setcookie( name -> name of the cookie value -> value of cookie ($_COOKIE[‘name’]) expire -> when cookie expires

(time() + 60 * 60 * 24 * 30) path -> path of where the cookie is available domain -> The domain that the cookie is

available to secure -> true or false for https httponly -> When true the cookie can only be

accessed and used through http)

Page 27: PHP: Hypertext Preprocessor

Cookies

Page 28: PHP: Hypertext Preprocessor

Databases & PDO

Oracle MySQL SQLite MS SQL More…

Page 29: PHP: Hypertext Preprocessor

Databases & PDO

PDO -> PHP Data Object

› Data-access abstraction layer

› http://php.net/manual/en/book.pdo.php

Page 30: PHP: Hypertext Preprocessor

Databases & PDO

Page 31: PHP: Hypertext Preprocessor

Future

PHP 6› Unicode support

› Enhanced array indexing

› Performance

› Break to labels

Page 32: PHP: Hypertext Preprocessor

Demos & Examples

http://cretz.github.com/dust-php/

http://www.razorflow.com/

http://www.php-compiler.net/

Page 33: PHP: Hypertext Preprocessor

Questions?