PHP

   »    Free PHP book resources & Tutorials

Computer Education, Training & Tutorial Resources - ComputerEducationWorld.com
Home » Free Computer Books » PHP »

Abstract classes
A class may be declared abstract to prevent it from being instantiated.
However, you may inherit from an abstract class:
abstract class MyBaseClass {
function display() {
print “Default display routine being called”;
}
}
Abstract methods.
A method may be declared abstract, thereby deferring its definition to an
inheriting class. A class that includes abstract methods must be declared
abstract:
abstract class MyBaseClass {
abstract function display();
}
Class type hints.
Function declarations may include class type hints for their parameters.
If the functions are called with an incorrect class type, an error occurs:
function expectsMyClass(MyClass $obj) {
}
Support for dereferencing objects that are returned from methods.
In PHP 4, you could not directly dereference objects that were returned
from methods. You had to first assign the object to a dummy variable and
then dereference it.
PHP 4:
$dummy = $obj->method();
$dummy->method2();
PHP 5:
$obj->method()->method2();
Iterators.
PHP 5 allows both PHP classes and PHP extension classes to implement
an Iterator interface. After you implement this interface, you can iterate
instances of the class by using the foreach() language
construct:
$obj = new MyIteratorImplementation();
foreach ($obj as $value) {
print “$value”;
}

(more…)


• • •
 

What Is New in PHP 5?
“The best way to be ready for the future is to invent it.”– John Sculley
1.1 INTRODUCTION
Only time will tell if the PHP 5 release will be as successful as its two prede-
cessors (PHP 3 and PHP 4). The new features and changes aim to rid PHP of
any weaknesses it may have had and make sure that it stays in the lead as the
world’s best web-scripting language.
This book details PHP 5 and its new features. However, if you are familiar
with PHP 4 and are eager to know what is new in PHP 5, this chapter is for you.
When you finish reading this chapter, you will have learned
The new language features
News concerning PHP extensions
Other noteworthy changes to PHP’s latest version

(more…)


• • •
 

This book could not have been written without feedback from our technical
reviewers; therefore, we would like to thank Marcus Börger, Steph Fox, Martin
Jansen, and Rob Richards for their excellent comments and feedback. Besides
these four reviewers, there are a few more people who helped answer several
questions during the writing of this book, more specifically Christian Stocker for
helping with the XML chapter, Wez Furlong and Sara Golemon for answering
questions about the streams layer, Pierre-Alain Joye for providing some insights
in the inner workings of the GD library, and less specifically the PEAR commu-
nity for their support and dedication to a great repository of usable PEAR com-
ponents. Some sections in this book were contributed by co-authors; Georg
Richter contributed the MySQLi section of the database chapter, and Zeev
Suraski added the section on Zend’s Performance Suite.
We would also like to thank Mark L. Taub and the editorial team of Pear-
son PTR for the things they are good at doing: organizing, planning, and mar-
keting this book, and making sure everything fits together. Thanks to Janet
Valade, for helpful developmental editing support, and our project editor
Kristy Hart, who helped us wrap up the book under pressure and put the final
touches on it.
Enjoy!
Andi, Stig, and Derick


• • •
 

Chapter 15, “An Introduction to Writing PHP Extensions,” explains how
to write your own custom PHP extension. We use a simple example to explain
the most important things like parameter parsing and resource management.
Chapter 16, “PHP Shell Scripting,” shows you how to write shell scripts
in PHP, because PHP is useful for more than just web applications. We care-
fully explain the differences between the CLI and CGI executables in which
PHP comes, including command-line parameter parsing and process control.
This book also includes three appendices. Appendix A, “PEAR and PECL
Package Index,” provides an overview of all important packages, with descrip-
tions and dependencies on other packages. Appendix B, “phpDocument Format
Reference,” explains the syntax as understood by the PHP Documenter tool to
generate API documentation from source code. Appendix C, “Zend Studio
Quick Start,” is an introduction to working in the Zend Studio IDE.

(more…)


• • •
 



captcha PHP Script Free PHP captcha script free php
Website Design by WebWalas.com