Apress PHP Object-Oriented Solutions (2008).pdf

(6926 KB) Pobierz
143585099 UNPDF
UnderstandbasicOOPconcepts,
suchasinheritance,encapsulation,
andpolymorphism.
ExtendcorePHPclasses.
Designandcreateyourownclasses
forPHP5and6.
DaviD Powers
143585099.041.png
 
143585099.042.png 143585099.043.png 143585099.001.png 143585099.002.png 143585099.003.png 143585099.004.png 143585099.005.png 143585099.006.png 143585099.007.png 143585099.008.png 143585099.009.png 143585099.010.png 143585099.011.png 143585099.012.png 143585099.013.png 143585099.014.png 143585099.015.png 143585099.016.png 143585099.017.png 143585099.018.png 143585099.019.png 143585099.020.png 143585099.021.png 143585099.022.png 143585099.023.png 143585099.024.png 143585099.025.png 143585099.026.png 143585099.027.png 143585099.028.png 143585099.029.png
 
143585099.030.png 143585099.031.png 143585099.032.png 143585099.033.png 143585099.034.png 143585099.035.png 143585099.036.png
 
PHP Object-Oriented
Solutions
David Powers
143585099.037.png 143585099.038.png
PHP Object-Oriented Solutions
Copyright © 2008 by David Powers
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-4302-1011-5
ISBN-13 (electronic): 978-1-4302-1012-2
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence
of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark
owner, with no intention of infringement of the trademark.
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor,
New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders- ny@springer-sbm.com, or
For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600,
Berkeley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use.
eBook versions and licenses are also available for most titles. For more information, reference our Special
Bulk Sales—eBook Licensing web page at http://www.apress.com/info/bulksales.
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution
has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to
any person or entity with respect to any loss or damage caused or alleged to be caused directly or
indirectly by the information contained in this work.
The source code for this book is freely available to readers at www.friendsofed.com in the Downloads section.
Credits
Lead Editor
Ben Renow-Clarke
Production Editor
Laura Esterman
Technical Reviewer
Seungyeob Choi
Compositor
Molly Sharp
Editorial Board
Clay Andres, Steve Anglin, Ewan Buckingham,
Tony Campbell, Gary Cornell, Jonathan Gennick,
Matthew Moodie, Joseph Ottinger, Jeffrey Pepper,
Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft,
Matt Wade, Tom Welsh
Proofreader
Patrick Vincent
Indexer
Toma Mulligan
Project Manager
Beth Christmas
Artist
April Milne
Copy Editors
Heather Lang and Damon Larson
Interior and Cover Designer
Kurt Krames
Associate Production Director
Kari Brooks-Copony
Manufacturing Director
Tom Debolski
143585099.039.png
CONTENTS AT A GLANCE
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Chapter 1: Why Object-Oriented PHP? . . . . . . . . . . . . . . . . . . . . . . . 3
Chapter 2: Writing PHP Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Chapter 3: Taking the Pain Out of Working with Dates . . . . . . . . 77
Chapter 4: Using PHP Filters to Validate User Input . . . . . . . . . . 121
Chapter 5: Building a Versatile Remote File Connector . . . . . . . 169
Chapter 6: SimpleXML—Couldn’t Be Simpler . . . . . . . . . . . . . . . 207
Chapter 7: Supercharged Looping with SPL . . . . . . . . . . . . . . . . . 251
Chapter 8: Generating XML from a Database . . . . . . . . . . . . . . . 289
Chapter 9: Case Study: Creating Your Own RSS Feed . . . . . . . . . 321
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
143585099.040.png
Zgłoś jeśli naruszono regulamin