cvs: phpweb / zend-engine-2.php

From: Date: Sun, 03 Aug 2003 11:41:36 +0000
Subject: cvs: phpweb / zend-engine-2.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-19781@lists.php.net to get a copy of this message
goba Sun Aug 3 07:41:36 2003 EDT Modified files: /phpweb zend-engine-2.php Log: Doh, <p> should not be a parent of <div>

Index: phpweb/zend-engine-2.php diff -u phpweb/zend-engine-2.php:1.13 phpweb/zend-engine-2.php:1.14 --- phpweb/zend-engine-2.php:1.13 Sun Aug 3 06:17:06 2003 +++ phpweb/zend-engine-2.php Sun Aug 3 07:41:36 2003 @@ -1,5 +1,5 @@ <?php -// $Id: zend-engine-2.php,v 1.13 2003/08/03 10:17:06 goba Exp $ +// $Id: zend-engine-2.php,v 1.14 2003/08/03 11:41:36 goba Exp $ $_SERVER['BASE_PAGE'] = 'zend-engine-2.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc'; commonHeader("Changes in PHP 5/Zend Engine 2.0"); @@ -33,14 +33,12 @@ PHP 5 introduces private and protected member variables, they allow you to define the visibility of class properties. </p> - <h3>Example</h3> <p> Protected member variables can be accessed in classes extending the class they are declared in, whereas private member variables can only be accessed by the class they belong to. </p> -<p> <?php highlight_php('<?php class MyClass { private $Hello = "Hello, World!\n"; @@ -77,15 +75,12 @@ print $obj->Foo; /* Shouldn\'t print out anything */ $obj->printHello(); ?>'); ?> -</p> <h2>Private and protected methods</h2> <p> With PHP 5 (Zend Engine 2), private and protected methods are also introduced. </p> - <h3>Example</h3> -<p> <?php highlight_php('<?php class Foo { private function aPrivateMethod() { @@ -108,8 +103,6 @@ $o = new Bar; $o->aPublicMethod(); ?>'); ?> -</p> - <p> Old code that has no user-defined classes or functions named "public", "protected" or "private" should run without modifications. @@ -122,7 +115,6 @@ A class that contains abstract methods needs to be declared abstract. </p> <h3>Example</h3> -<p> <?php highlight_php('<?php abstract class AbstractClass { abstract public function test(); @@ -137,22 +129,17 @@ $o = new ImplementedClass; $o->test(); ?>'); ?> -</p> - <p> Abstract classes cannot be instantiated. Old code that has no user-defined classes or functions named 'abstract' should run without modifications. </p> <h2>Interfaces</h2> - <p> The Zend Engine 2.0 introduces interfaces. A class may implement an arbitrary list of interfaces. </p> - <h3>Example</h3> -<p> <?php highlight_php('<?php interface Throwable { public function getMessage(); @@ -163,8 +150,6 @@ // ... } ?>'); ?> -</p> - <p> Old code that has no user-defined classes or functions named 'interface' or 'implements' should run without modifications. @@ -177,7 +162,6 @@ to a method. </p> <h3>Example</h3> -<p> <?php highlight_php('<?php interface Foo { function a(Foo $foo); @@ -203,12 +187,10 @@ $a->a($b); $a->b($b); ?>'); ?> -</p> <p> These class type hints are not checked upon compilation, as would be the case in a typed language, but during runtime. This means that: </p> -<p> <?php highlight_php('<?php function foo(ClassName $object) { @@ -216,11 +198,9 @@ } ?>'); ?> -</p> <p> is equivalent to: </p> -<p> <?php highlight_php('<?php function foo($object) { @@ -229,7 +209,6 @@ } } ?>'); ?> -</p> <p> This syntax only applies to objects/classes, not built-in types. </p> @@ -240,7 +219,6 @@ Methods and members declared final cannot be overridden by sub-classes. </p> <h3>Example</h3> -<p> <?php highlight_php('<?php class Foo { final function bar() { @@ -248,7 +226,6 @@ } } ?>'); ?> -</p> <p> Old code that has no user-defined classes or functions named 'final' should run without modifications. @@ -273,11 +250,9 @@ <p> An object copy is created by calling the object's <code>__clone()</code> method: </p> -<p> <?php highlight_php('<?php $copy_of_object = $object->__clone(); ?>'); ?> -</p> <p> When the developer asks to create a new copy of an object, the Zend Engine will check if a <code>__clone()</code> method has been defined or not. If not, it @@ -289,7 +264,6 @@ source object, and only override properties that need to be changed. </p> <h3>Example</h3> -<p> <?php highlight_php('<?php class MyCloneable { static $id = 0; @@ -319,7 +293,6 @@ print $obj->address . "\n"; ?>'); ?> -</p> <h2>Unified Constructors</h2> <p> @@ -341,7 +314,6 @@ them by the name <code>__construct()</code>. </p> <h3>Example</h3> -<p> <?php highlight_php('<?php class BaseClass { function __construct() { @@ -359,7 +331,6 @@ $obj = new BaseClass(); $obj = new SubClass(); ?>'); ?> -</p> <p> For backwards compatibility, if PHP 5 cannot find a <code>__construct()</code> function for a given class, it will search for the old-style constructor function, @@ -383,7 +354,6 @@ that recieves no parameters, is called before the object is freed from memory. </p> <h3>Example</h3> -<p> <?php highlight_php('<?php class MyDestructableClass { function __construct() { @@ -398,7 +368,6 @@ $obj = new MyDestructableClass(); ?>'); ?> -</p> <p> Like constructors, parent destructors will not be called implicitly by the engine. In order to run a parent destructor, one would have to explicitly @@ -409,7 +378,6 @@ <p> PHP 5 introduces per-class constants: </p> -<p> <?php highlight_php('<?php class Foo { const constant = "constant"; @@ -417,13 +385,11 @@ echo "Foo::constant = " . Foo::constant . "\n"; ?>'); ?> -</p> <p> PHP 5 allows for expressions within constants, however, constants are evaluated at compile time, therefore no constants can be declared that rely on runtime information. </p> -<p> <?php highlight_php('<?php class Bar { const a = 1<<0; @@ -431,7 +397,6 @@ const c = a | b; } ?>'); ?> -</p> <p> Old code that has no user-defined classes or functions named 'const' will run without modifications. @@ -443,7 +408,6 @@ to that of other programming languages. </p> <h3>Example</h3> -<p> <?php highlight_php('<?php class MyExceptionFoo extends Exception { function __construct($exception) { @@ -457,7 +421,6 @@ print $exception->getMessage(); } ?>'); ?> -</p> <p> Old code that has no user-defined classes or functions 'catch', 'throw' and 'try' will run without modifications. @@ -469,7 +432,6 @@ and make further method calls on those objects. With the advent of Zend Engine 2, the following is now possible: </p> -<p> <?php highlight_php('<?php class Circle { function draw() { @@ -495,11 +457,9 @@ ShapeFactoryMethod("Circle")->draw(); ShapeFactoryMethod("Square")->draw(); ?>'); ?> -</p> <h2>Static member variables of static classes can now be initialized</h2> <h3>Example</h3> -<p> <?php highlight_php('<?php class foo { static $my_static = 5; @@ -507,7 +467,6 @@ print foo::$my_static; ?>'); ?> -</p> <h2>Static Methods</h2> <p> @@ -515,7 +474,6 @@ callable from outside the object context. </p> <h3>Example</h3> -<p> <?php highlight_php('<?php class Foo { public static function aStaticMethod() { @@ -525,7 +483,6 @@ Foo::aStaticMethod(); ?>'); ?> -</p> <p> The pseudo variable <code>$this</code> is not available inside a method that has been declared static. @@ -538,7 +495,6 @@ a class, or implements an interface. </p> <h3>Example</h3> -<p> <?php highlight_php('<?php class baseClass { } @@ -548,7 +504,6 @@ echo "Hello World"; } ?>'); ?> -</p> <h2>Static function variables</h2> <p> @@ -560,7 +515,6 @@ <h2>Parameters that are passed by reference to a function may now have default values</h2> <h3>Example</h3> -<p> <?php highlight_php('<?php function my_function(&$var = null) { if ($var === null) { @@ -568,7 +522,6 @@ } } ?>'); ?> -</p> <h2>__autoload()</h2> <p> @@ -577,7 +530,6 @@ passed to the <code>__autoload()</code> interceptor function as its only argument. </p> <h3>Example</h3> -<p> <?php highlight_php('<?php function __autoload($className) { include_once $className . ".php"; @@ -585,7 +537,6 @@ $object = new ClassName; ?>'); ?> -</p> <h2>Overloadable Method calls and Property accesses</h2> <p> @@ -594,7 +545,6 @@ methods. </p> <h3>Example: __get() and __set()</h3> -<p> <?php highlight_php('<?php class Setter { public $n; @@ -631,9 +581,7 @@ $foo->z++; var_dump($foo); ?>'); ?> -</p> <h3>Example: __call()</h3> -<p> <?php highlight_php('<?php class Caller { var $x = array(1, 2, 3); @@ -649,6 +597,5 @@ $a = $foo->test(1, "2", 3.4, true); var_dump($a); ?>'); ?> -</p> <?php commonFooter(); ?>
« previous php.mirrors (#19781) next »