Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Professional PHP6
|
BOOK: Professional PHP6
This is the forum to discuss the Wrox book Professional PHP6 by Edward Lecky-Thompson, Steven Nowicki; ISBN: 9780470395097
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional PHP6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 21st, 2012, 03:41 AM
Registered User
 
Join Date: Apr 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Some Code Errors and Advice

I am a student major Software Engineering in SCNU of China.
I have used PHP for nearly one year and I love it for its simpleness.
But it is the book <<Professional PHP6>> make me know more about PHP.
It is really an usefull book!

And here is some code errors I have found in the book(Chinese Version).

1. CH 8 PAGE: 191
//the code in the book
abstract class Event_Handler
{

}

//my code
//according the chart 8-2
abstract class Event_Handler extends Handled
{

}

2. CH 9 PAGE: 201
//the code in the book
$strLogLevel = $this->levelToString($logLevel);

//my code
//it's a static function
$strLogLevel = $Logger::levelToString($logLevel);


And here is some personal advice for the some code.

1. CH7 Page: 181

//the code in the book
private function GetAccessor($strMember){
if($this->blIsLoaded != true){
$this->Load();
}
//the rest code....
}

//my code
private function GetAccessor($strMember){

$this->Load();

//the rest code....
}

//Page 173
public function Load(){
//move the condition here, check whether loaded or not in Load(), to advoid repeat code when call this fun.
if($this->blIsLoade)
return;

if(isset($this->ID)){
//the rest code....
}
}

2. CH 11 PAGE: 251
//the code in the book
$this->arRecipientCollection->addItem($objRecipient, $strIdentifier);

//my code
//should check the value is null or not to ensure it has been initialized, even though it will be created in child's __construct()
if(isset($this->arRecipientCollection))
$this->arRecipientCollection->addItem($objRecipient, $strIdentifier);


3. CH 9 PAGE: 212
//the code in the book

$host = $urlData['host'];
$port = $urlData['port '];
$user = $urlData['user'];
$passwrod= $urlData['passwrod'];
$arPath= explode('/', $urlData['path']);

//my code
//because the urlData should be parsed in the __construct fun
$host = $this->urlData['host'];
$port = $this->urlData['port '];
$user = $this->urlData['user'];
$passwrod= $this->urlData['passwrod'];
$arPath= explode('/', $this->urlData['path']);

PS: I will find others code error at later chapter.


Last edited by chanzonghuang; April 21st, 2012 at 08:55 AM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Program Code Errors ed123 Beginning PHP 0 September 8th, 2007 03:53 AM
Need advice to clean up my date manipulation code jasoncompo Beginning VB 6 1 June 2nd, 2006 01:29 PM
Code for review advice, is there a hole? mat41 Classic ASP Professional 0 February 10th, 2006 08:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.