cvs: presentations /slides/php5intro abstract.php abstract.xml abstract1.xml abstract_swans.jpg access1.php access2.php access3.php access4.php
alias.php autoload.php autoload.xml banana.gif clone2.php const.php const.xml construct.php construct.xml construct1.php copy.xml copy1.xml deref.xml
deref_php4.php deref_php5.php destruct.php destruct.xml dolly.jpg except.php except1.php exceptions.xml exceptions1.xml final.xml final1.php
game10_carmen1.jpg interface1.php interface2.php interfaces.xml interfaces1.xml larry.gif monkey.php music_britney_pepsi_gr.jpg namespace.php
namespace.xml nestednamespaces.xml newoo1.xml nnamespaces.php oldobjects1.php oldobjects2.php oldoo.xml overload.php overload.xml overload1.php
overload1.xml ppp.xml ppp1.xml ppp2.xml ppp3.xml referencecounting.php static.php static.xml static1.php static1.xml static2.php
static_electricity.gif static_girl.jpg svariables.xml titlepage.xml typehint.xml typehints.php variables.xml

From: Date: Sun, 23 Mar 2003 04:35:37 +0000
Subject: cvs: presentations /slides/php5intro abstract.php abstract.xml abstract1.xml abstract_swans.jpg access1.php access2.php access3.php access4.php
alias.php autoload.php autoload.xml banana.gif clone2.php const.php const.xml construct.php construct.xml construct1.php copy.xml copy1.xml deref.xml
deref_php4.php deref_php5.php destruct.php destruct.xml dolly.jpg except.php except1.php exceptions.xml exceptions1.xml final.xml final1.php
game10_carmen1.jpg interface1.php interface2.php interfaces.xml interfaces1.xml larry.gif monkey.php music_britney_pepsi_gr.jpg namespace.php
namespace.xml nestednamespaces.xml newoo1.xml nnamespaces.php oldobjects1.php oldobjects2.php oldoo.xml overload.php overload.xml overload1.php
overload1.xml ppp.xml ppp1.xml ppp2.xml ppp3.xml referencecounting.php static.php static.xml static1.php static1.xml static2.php
static_electricity.gif static_girl.jpg svariables.xml titlepage.xml typehint.xml typehints.php variables.xml
Groups: php.pres 
Request: Send a blank email to pres+get-606@lists.php.net to get a copy of this message
sterling Sat Mar 22 23:35:37 2003 EDT Added files: /presentations/slides/php5intro abstract.php abstract.xml abstract1.xml abstract_swans.jpg access1.php access2.php access3.php access4.php alias.php autoload.php autoload.xml banana.gif clone2.php const.php const.xml construct.php construct.xml construct1.php copy.xml copy1.xml deref.xml deref_php4.php deref_php5.php destruct.php destruct.xml dolly.jpg except.php except1.php exceptions.xml exceptions1.xml final.xml final1.php game10_carmen1.jpg interface1.php interface2.php interfaces.xml interfaces1.xml larry.gif monkey.php music_britney_pepsi_gr.jpg namespace.php namespace.xml nestednamespaces.xml newoo1.xml nnamespaces.php oldobjects1.php oldobjects2.php oldoo.xml overload.php overload.xml overload1.php overload1.xml ppp.xml ppp1.xml ppp2.xml ppp3.xml referencecounting.php static.php static.xml static1.php static1.xml static2.php static_electricity.gif static_girl.jpg svariables.xml titlepage.xml typehint.xml typehints.php variables.xml Log: add my php5intro presentation for nyphp

Index: presentations/slides/php5intro/abstract.php +++ presentations/slides/php5intro/abstract.php <?php abstract class dali { abstract function paint(); } class sterling extends dali { function paint() { echo "this is corny "; echo "impressionism humor."; echo "\n<br />\n"; } } $s = new sterling; $s->paint(); ?> Index: presentations/slides/php5intro/abstract.xml +++ presentations/slides/php5intro/abstract.xml <slide> <title>Abstract</title> <image filename="abstract_swans.jpg" align="center" /> </slide> Index: presentations/slides/php5intro/abstract1.xml +++ presentations/slides/php5intro/abstract1.xml <slide> <title>Abstract</title> <example filename="abstract.php" result="1" /> </slide> Index: presentations/slides/php5intro/access1.php +++ presentations/slides/php5intro/access1.php <?php class cia { var $agents = array(); function remove_secret_ops($agent) { return $agent != 'Sterling'; } function get_agents() { return array_filter( $this->agents, array($this, 'remove_secret_ops') ); } function add_agent($name) { array_push($this->agents, $name); } } class cia_administration extends cia { function __construct() { $this->add_agent('Sterling'); $this->add_agent('Zeev'); $this->add_agent('Andi'); $this->add_agent('Rasmus'); $this->add_agent('Thies'); } } $cia = new cia_administration; $pubagents = $cia->get_agents(); $allagents = $cia->agents; $secretops = array_diff($allagents, $pubagents); foreach ($secretops as $sop) { echo "$sop is a undercover spy, "; echo "let's assasinate him! "; echo "Viva la Perl!\n<br />\n"; } ?> Index: presentations/slides/php5intro/access2.php +++ presentations/slides/php5intro/access2.php <?php class cia { private $agents = array(); function remove_secret_ops($agent) { return $agent != 'Sterling'; } function get_agents() { return array_filter( $this->agents, array($this, 'remove_secret_ops') ); } function add_agent($name) { array_push($this->agents, $name); } } class cia_administration extends cia { function __construct() { $this->add_agent('Sterling'); $this->add_agent('Zeev'); $this->add_agent('Andi'); $this->add_agent('Rasmus'); $this->add_agent('Thies'); } } $cia = new cia_administration; $pubagents = $cia->get_agents(); $allagents = $cia->agents; $secretops = array_diff($allagents, $pubagents); foreach ($secretops as $sop) { echo "$sop is a undercover spy, "; echo "let's assasinate him! "; echo "Viva la Perl!\n<br />\n"; } ?> Index: presentations/slides/php5intro/access3.php +++ presentations/slides/php5intro/access3.php <?php class cia { private $agents = array(); function remove_secret_ops($agent) { return $agent != 'Sterling'; } function get_agents() { return array_filter($this->agents, array($this, 'remove_secret_ops') ); } function add_agent($name) { array_push($this->agents, $name); } } class cia_administration extends cia { function __construct() { $this->add_agent('Sterling'); $this->add_agent('Zeev'); $this->add_agent('Andi'); $this->add_agent('Rasmus'); $this->add_agent('Thies'); } } $cia = new cia_administration; $pubagents = $cia->get_agents(); $allagents = $cia->agents; $secretops = array_diff($allagents, $pubagents); foreach ($secretops as $sop) { echo "$sop is a undercover spy, "; echo "let's assasinate him! "; echo "Viva la Perl!\n<br />\n"; } $cia->add_agent('Larry Wall'); $newagents = $cia->get_agents(); foreach ($newagents as $agent) { echo "$agent is ok, he can go "; echo "through security.\n<br />\n"; } ?> Index: presentations/slides/php5intro/access4.php +++ presentations/slides/php5intro/access4.php <?php class cia { private $agents = array(); private function remove_secret_ops($agent) { return $agent != 'Sterling'; } function get_agents() { return array_filter($this->agents, array($this, 'remove_secret_ops') ); } protected function add_agent($name) { array_push($this->agents, $name); } } class cia_administration extends cia { function __construct() { $this->add_agent('Sterling'); $this->add_agent('Zeev'); $this->add_agent('Andi'); $this->add_agent('Rasmus'); $this->add_agent('Thies'); } } $cia = new cia_administration; $pubagents = $cia->get_agents(); $allagents = $cia->agents; $secretops = array_diff($allagents, $pubagents); foreach ($secretops as $sop) { echo "$sop is a undercover spy, "; echo "let's assasinate him! "; echo "Viva la Perl!\n<br />\n"; } $cia->add_agent('Larry Wall'); $newagents = $cia->get_agents(); foreach ($newagents as $agent) { echo "$agent is ok, he can go "; echo "through security.\n<br />\n"; } ?> Index: presentations/slides/php5intro/alias.php +++ presentations/slides/php5intro/alias.php <?php // refcount = 1 $name = "Sterling"; // refcount = 2, is_ref $newname = &$name; // refcount = 2 $newname .= " Hughes"; // Sterling Hughes echo $newname; // Sterling Hughes echo $name; ?> Index: presentations/slides/php5intro/autoload.php +++ presentations/slides/php5intro/autoload.php <?php function __autoload($classname) { include_once("$classname.php"); } $mono = new monkey; $mono->scratch(); ?> Index: presentations/slides/php5intro/autoload.xml +++ presentations/slides/php5intro/autoload.xml <slide> <title>Autoloading</title> <blurb> PHP5 allows you to register a function (%__autoload%) which will autosatisfy class dependencies. </blurb> <example filename="monkey.php" title="Library Code (monkey.php)" /> <example filename="autoload.php" title="Autoload Usage" result="1" /> </slide> Index: presentations/slides/php5intro/clone2.php +++ presentations/slides/php5intro/clone2.php <?php class sheep { var $name; } $start = new sheep; $start->name = "Dolly"; $new = $start->__clone(); $new->name = "Molly"; var_dump($start); ?> Index: presentations/slides/php5intro/const.php +++ presentations/slides/php5intro/const.php <?php class porsche { const price = "too much"; } echo "A nice Porsche will always cost "; echo porsche::price . "\n<br />\n"; ?> Index: presentations/slides/php5intro/const.xml +++ presentations/slides/php5intro/const.xml <slide> <title>Constants</title> <blurb> PHP5 supports %class% and %namespace% level %define%'s, known as constants (%const%). </blurb> <example filename="const.php" result="1" /> </slide> Index: presentations/slides/php5intro/construct.php +++ presentations/slides/php5intro/construct.php <?php class banana_v4 { function banana_v4() { echo "peel..peel.."; echo "\n<br />\n"; } function eat() { echo "chewy..chewy.."; echo "\n<br />\n"; } } $b = new banana_v4(); $b->eat(); ?> Index: presentations/slides/php5intro/construct.xml +++ presentations/slides/php5intro/construct.xml <slide> <title>Unified Constructors</title> <blurb fontsize="3.5em"> In PHP 4 constructors had the same name as the class itself. </blurb> <image filename="banana.gif" align="center" /> <example filename="construct.php" result="1" /> <blurb fontsize="3.5em"> In PHP 5 constructors are unified, under the name %__construct()%. </blurb> <example filename="construct1.php" result="1" /> </slide> Index: presentations/slides/php5intro/construct1.php +++ presentations/slides/php5intro/construct1.php <?php class banana_v5 { function __construct() { echo "peel..peel.."; echo "\n<br />\n"; } function eat() { echo "chewy..chewy.."; echo "\n<br />\n"; } } $b = new banana_v5(); $b->eat(); ?> Index: presentations/slides/php5intro/copy.xml +++ presentations/slides/php5intro/copy.xml <slide> <title>Of Sheep and Objects</title> <blurb> Objects are references, so how do you copy objects? </blurb> <image align="center" filename="dolly.jpg" /> </slide> Index: presentations/slides/php5intro/copy1.xml +++ presentations/slides/php5intro/copy1.xml <slide> <title>Attack of the...</title> <blurb fontsize="3.5em"> Clones! </blurb> <example filename="clone2.php" /> </slide> Index: presentations/slides/php5intro/deref.xml +++ presentations/slides/php5intro/deref.xml <slide> <title>Object Dereferencing</title> <blurb fontsize="3.5em"> In PHP 4 objects had to be manually dereferenced. </blurb> <example title="PHP4 Way" filename="deref_php4.php" result="1" /> <blurb fontsize="3.5em"> PHP 5 Automatically dereferences objects for you. </blurb> <example title="PHP5 Way" filename="deref_php5.php" result="1" /> </slide> Index: presentations/slides/php5intro/deref_php4.php +++ presentations/slides/php5intro/deref_php4.php <?php class foo_v4 { function bar() { return new bar_v4; } } class bar_v4 { function barbarina () { echo "booh!"; echo "\n<br />\n"; } } $f = new foo_v4; $tmp = $f->bar(); $tmp->barbarina(); ?> Index: presentations/slides/php5intro/deref_php5.php +++ presentations/slides/php5intro/deref_php5.php <?php class foo_v5 { function bar() { return new bar_v5; } } class bar_v5 { function barbarina () { echo "booh!"; echo "\n<br />\n"; } } $f = new foo_v5; $f->bar()->barbarina(); ?> Index: presentations/slides/php5intro/destruct.php +++ presentations/slides/php5intro/destruct.php <?php class banana { function __construct() { echo "peel..peel.."; echo "\n<br />\n"; } function eat() { echo "chewy..chewy.."; echo "\n<br />\n"; } function __destruct() { echo "slip... crack!"; echo "\n<br />\n"; } } $b = new banana(); $b->eat(); ?> Index: presentations/slides/php5intro/destruct.xml +++ presentations/slides/php5intro/destruct.xml <slide> <title>Destructors</title> <blurb fontsize="3.5em"> PHP 5 also adds the concept of destructors, functions that are called when a class is destroyed. </blurb> <example filename="destruct.php" result="1" /> </slide> Index: presentations/slides/php5intro/except.php +++ presentations/slides/php5intro/except.php <?php define('NUM', 10); try { if (NUM < 20) { throw new Exception( NUM . " is too small!" ); } } catch (Exception $e) { echo $e->getMessage(); echo "\n<br />\n"; } ?> Index: presentations/slides/php5intro/except1.php +++ presentations/slides/php5intro/except1.php <?php class TooLittleException extends Exception { private $num; function TooLittleException($num) { parent::exception(); $this->num = $num; } function getMessage() { return $this->num . " is too small!"; } } define('NUM', 10); try { if (NUM < 20) { throw new TooLittleException(NUM); } } catch (TooLittleException $e) { echo $e->getMessage(); echo "\n<br />\nIn file: "; echo $e->getFile(); echo "\n<br />\n"; } ?> Index: presentations/slides/php5intro/exceptions.xml +++ presentations/slides/php5intro/exceptions.xml <slide> <title>Exceptions</title> <blurb fontsize="3.5em"> PHP 5 supports exceptions, via %try%, %catch% and %throw%. </blurb> <blurb fontsize="3.5em"> The default exception is the %Exception% class. </blurb> <example filename="except.php" result="1" /> </slide> Index: presentations/slides/php5intro/exceptions1.xml +++ presentations/slides/php5intro/exceptions1.xml <slide> <title>Custom Exceptions</title> <blurb fontsize="3.5em"> To define custom exceptions, just extend the %Exception% base class. </blurb> <example filename="except1.php" fontsize="1.8em" result="1" /> </slide> Index: presentations/slides/php5intro/final.xml +++ presentations/slides/php5intro/final.xml <slide> <title>Final</title> <image filename="music_britney_pepsi_gr.jpg" align="right" /> <blurb fontsize="3.5em"> Final allows you to restrict a variable from being modified. </blurb> <blurb><![CDATA[<br /><br /><br /><br />]]> </blurb> <example title="Prank Prevention!" filename="final1.php" result="1" /> </slide> Index: presentations/slides/php5intro/final1.php +++ presentations/slides/php5intro/final1.php <?php class Brand { final public $type = 'Softdrink'; public $name; } class Pepsi extends Brand { public $type = 'Laxative'; function __construct() { $this->name = 'Pepsi'; } } $p = new Pepsi(); echo "{$p->name} is {$p->type}\n"; ?> Index: presentations/slides/php5intro/interface1.php +++ presentations/slides/php5intro/interface1.php <?php class board_game { function move_next() { echo "next\n"; } function move_prev() { echo "prev\n"; } } interface price { function get_price(); } class monopoly extends board_game implements price { function get_price() { return 22.95; } } $g = new monopoly; if ($g instanceof price) { var_dump($g->get_price()); } ?> Index: presentations/slides/php5intro/interface2.php +++ presentations/slides/php5intro/interface2.php <?php define('SERIALIZED', './presentations/slides/php5intro/serialized'); interface ISerializable { function sleep(); function wakeup(); }; class Person implements ISerializable { public $name; function sleep() { file_set_contents(SERIALIZED, serialize($this->name) ); } function wakeup() { $this->name = unserialize( file_get_contents(SERIALIZED) ); } } $p = new Person; if ($p instanceof ISerializable) { $p->wakeup(); } echo "Previous Spy: {$p->name}\n<br />\n"; $superspies = array('James Bond', 'Sterling Hughes', 'Austin Powers'); $p->name = $superspies[array_rand($superspies)]; echo "New Spy: {$p->name}\n<br />\n"; if ($p instanceof ISerializable) { $p->sleep(); } ?> Index: presentations/slides/php5intro/interfaces.xml +++ presentations/slides/php5intro/interfaces.xml <slide> <title>Interfaces</title> <blurb fontsize="3.5em"> Interfaces allow you to define a class that is guaranteed to implement a certain set of functions. </blurb> <example filename="interface1.php" result="1" /> </slide> Index: presentations/slides/php5intro/interfaces1.xml +++ presentations/slides/php5intro/interfaces1.xml <slide> <title>Interfaces cont.</title> <example filename="interface2.php" result="1" fontsize="1.8em" /> </slide> Index: presentations/slides/php5intro/monkey.php +++ presentations/slides/php5intro/monkey.php <?php class monkey { function scratch() { echo "itchy! itchy!\n"; } } ?> Index: presentations/slides/php5intro/namespace.php +++ presentations/slides/php5intro/namespace.php <?php namespace Language { class Python { function exec_stmt($stmt) { $command = escapeshellcmd($stmt); system("echo $command | python"); } } class Perl { function exec_stmt($stmt) { $command = escapeshellcmd($stmt); system("echo $command | perl"); } } class PHP { function exec_stmt($stmt) { eval($stmt); } } } $p = new Language::Perl; $p->exec_stmt("print 'Hello Freaky Deaky World!'"); ?> Index: presentations/slides/php5intro/namespace.xml +++ presentations/slides/php5intro/namespace.xml <slide> <title>Namespaces</title> <blurb> PHP 5 sports namespaces. </blurb> <example filename="namespace.php" result="1" fontsize="1.8em" /> </slide> Index: presentations/slides/php5intro/nestednamespaces.xml +++ presentations/slides/php5intro/nestednamespaces.xml <slide> <title>Nested Namespaces</title> <blurb fontsize="3.5em"> Nested namespaces are supported as syntactical sugar. </blurb> <example filename="nnamespaces.php" result="1" fontsize="1.8em" /> </slide> Index: presentations/slides/php5intro/newoo1.xml +++ presentations/slides/php5intro/newoo1.xml <slide> <title>New Object Model</title> <blurb fontsize="3.5em"> PHP 5 OO - Objects are automatically references. </blurb> <example filename="oldobjects2.php" /> </slide> Index: presentations/slides/php5intro/nnamespaces.php +++ presentations/slides/php5intro/nnamespaces.php <?php namespace Languages:Perl { class Execute { function statement($cmd) { $cmd = escapeshellcmd($cmd); system("echo $cmd | perl"); } } class Insult { function oneLiner() { echo "Perl is soo ugly, even "; echo "Microsoft can't embrace it"; echo "\n<br />\n"; } } } $e = new Languages:Perl::Execute; $e->statement("print 'Hello World!'"); echo "\n<br />\n"; $i = new Languages:Perl::Insult; $i->oneLiner(); ?> Index: presentations/slides/php5intro/oldobjects1.php +++ presentations/slides/php5intro/oldobjects1.php <?php class Brand { var $name; } function change_name(&$drinkobj, $name) { $drinkobj->name = $name; } // avoid double copy $drink = &new Brand; $drink->name = 'Coke'; var_dump($drink->name); change_name($drink, 'Pepsi'); echo "{$drink->name} the choice of a new generation\n"; ?> Index: presentations/slides/php5intro/oldobjects2.php +++ presentations/slides/php5intro/oldobjects2.php <?php class Brand { var $name; } function change_name($drinkobj, $name) { $drinkobj->name = $name; } $drink = new Brand; $drink->name = 'Coke'; var_dump($drink->name); change_name($drink, 'Pepsi'); echo "{$drink->name} the choice of a new generation\n"; ?> Index: presentations/slides/php5intro/oldoo.xml +++ presentations/slides/php5intro/oldoo.xml <slide> <title>Old Object Model</title> <blurb fontsize="3.5em"> PHP 4 OO wasn't - Objects were base types. </blurb> <blurb fontsize="3.0em"> You needed to explicitly pass objects by reference. </blurb> <blurb fontsize="3.0em"> You even needed to *instantiate* them by reference. </blurb> <example filename="oldobjects1.php" /> </slide> Index: presentations/slides/php5intro/overload.php +++ presentations/slides/php5intro/overload.php <?php class DBM { private $members; private $file; function __construct($file) { $this->members = unserialize( file_get_contents($file) ); $this->file = $file; } function __get($name) { return $this->members[$name]; } function __set($name, $value) { $this->members[$name] = $value; } function __destruct() { file_set_contents($this->file, serialize($this->members) ); } } $dbm = new DBM( './presentations/slides/php5intro/db' ); echo "Hello {$dbm->name}!\n"; $dbm->name = 'Sterling'; ?> Index: presentations/slides/php5intro/overload.xml +++ presentations/slides/php5intro/overload.xml <slide> <title>Object Overloading</title> <blurb fontsize="3.5em"> In PHP5 there exists engine level object overloading for variables via the %__get()% and %__set()% accessors. </blurb> <example filename="overload.php" result="1" /> </slide> Index: presentations/slides/php5intro/overload1.php +++ presentations/slides/php5intro/overload1.php <?php class figtree { function __call($name, $args) { } } $d = new ?> Index: presentations/slides/php5intro/overload1.xml +++ presentations/slides/php5intro/overload1.xml <slide> <title>Object Overloading</title> <blurb fontsize="3.5em"> You can overload function calls via the %__call()% handler. </blurb> <example filename="overload1.php" result="1" /> </slide> Index: presentations/slides/php5intro/ppp.xml +++ presentations/slides/php5intro/ppp.xml <slide> <title>Access Control</title> <image align="left" valign="middle" filename="game10_carmen1.jpg" /> <blurb fontsize="3.5em"> In PHP4 you could not enforce access control. </blurb> <blurb><![CDATA[<br /><br /><br /><br /><br /><br /><br />]]></blurb> <example filename="access1.php" result="1" title="Infiltration!" /> </slide> Index: presentations/slides/php5intro/ppp1.xml +++ presentations/slides/php5intro/ppp1.xml <slide> <title>PPP</title> <blurb fontsize="3.5em"> PHP5 introduces *P*rivate, *P*rotected, and *P*ublic. </blurb> <blurb> </blurb> <blurb fontsize="3.5em"> Private allows access only to members of the current class. </blurb> <example filename="access2.php" result="1" /> </slide> Index: presentations/slides/php5intro/ppp2.xml +++ presentations/slides/php5intro/ppp2.xml <slide> <title>Protected</title> <blurb fontsize="3.5em"> Protected allows access to the current class, and child classes. </blurb> <example filename="access3.php" result="1" /> </slide> Index: presentations/slides/php5intro/ppp3.xml +++ presentations/slides/php5intro/ppp3.xml <slide> <title>Protected cont.</title> <blurb fontsize="3.5em"> Don't let Larry add %$_% to PHP! </blurb> <image align="center" filename="larry.gif" width="200" /> <example filename="access4.php" fontsize="1.5em" result="1" /> </slide> Index: presentations/slides/php5intro/referencecounting.php +++ presentations/slides/php5intro/referencecounting.php <?php // refcount = 1 $name = "Sterling"; // refcount = 2 (no copy) $newname = $name; // refcount = 2 echo $name; // $newname is copy of $name, $newname refcount 1 // $name refcount 1 $newname .= " Hughes"; // refcount = 1 echo $newname; ?> Index: presentations/slides/php5intro/static.php +++ presentations/slides/php5intro/static.php <?php namespace DB { class Globals { static $NAME = "sterling"; static $HOST = "localhost"; static $USER = "sterling"; static $PASS = "itsasecret"; } } echo DB::Globals::$NAME; echo "\n<br />\n"; DB::Globals::$HOST = "db42.pair.com"; echo DB::Globals::$HOST; echo "\n<br />\n"; ?> Index: presentations/slides/php5intro/static.xml +++ presentations/slides/php5intro/static.xml <slide> <title>Static</title> <image filename="static_electricity.gif" align="center" width="490" height="530" /> </slide> Index: presentations/slides/php5intro/static1.php +++ presentations/slides/php5intro/static1.php <?php class Foo { function getName() { return $this->name; } } print Foo::getName(); ?> Index: presentations/slides/php5intro/static1.xml +++ presentations/slides/php5intro/static1.xml <slide> <title>Static Members</title> <blurb> PHP 5 supports static class functions, which is a compiler hint that enforces static usage. </blurb> <example title="Without Static" filename="static1.php" result="1" /> <example title="With Static" filename="static2.php" result="1" /> </slide> Index: presentations/slides/php5intro/static2.php +++ presentations/slides/php5intro/static2.php <?php class Bar { static function getName() { return $this->name; } } print Bar::getName(); ?> Index: presentations/slides/php5intro/svariables.xml +++ presentations/slides/php5intro/svariables.xml <slide> <title>Variables</title> <blurb> PHP 5 supports static class variables. </blurb> <example filename="static.php" result="1" /> </slide> Index: presentations/slides/php5intro/titlepage.xml +++ presentations/slides/php5intro/titlepage.xml <slide fontsize="3.5em"> <title>Welcome</title> <blurb> </blurb> <blurb align="center" fontsize="6.0em">Introduction to PHP5</blurb> <blurb align="center" fontsize="4.0em">NYPHP</blurb> <blurb align="center">March 25, 2003</blurb> <link align="center" leader="Sterling Hughes, " text="sterling@php.net" href="mailto:sterling@php.net"/> </slide> Index: presentations/slides/php5intro/typehint.xml +++ presentations/slides/php5intro/typehint.xml <slide> <title>Type Hinting</title> <blurb fontsize="3.5em"> PHP 5 allows you restrict variables to complex types </blurb> <example fontsize="1.8em" filename="typehints.php" result="1" /> </slide> Index: presentations/slides/php5intro/typehints.php +++ presentations/slides/php5intro/typehints.php <?php interface pump { function get_gas(); } class premium implements pump { function get_gas() { echo "chug..chug..chug!\n<br />\n"; } } class regular implements pump { function get_gas() { echo "chug..cough..chug..\n<br />\n"; } } class mercedes { function infuse_gas(premium $pump) { echo "mercedes: "; $pump->get_gas(); } } class pinto { function infuse_gas(pump $pump) { echo "pinto: "; $pump->get_gas(); } } $pinto = new pinto; $pinto->infuse_gas(new premium); $pinto->infuse_gas(new regular); $mercedes = new mercedes; $mercedes->infuse_gas(new premium); $mercedes->infuse_gas(new regular); ?> Index: presentations/slides/php5intro/variables.xml +++ presentations/slides/php5intro/variables.xml <slide> <title>Variables</title> <blurb fontsize="3.5em"> PHP uses reference counting to manage base types. </blurb> <example filename="referencecounting.php" /> <blurb fontsize="3.5em"> To avoid copy-on-write, you would use the alias operator (%&amp;%). </blurb> <example filename="alias.php" /> </slide>
« previous php.pres (#606) next »