Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1
BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1
This is the forum to discuss the Wrox book Professional PHP5 by Ed Lecky-Thompson, Heow Eide-Goodman, Steven D. Nowicki, Alec Cove; ISBN: 9780764572821
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 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 May 12th, 2009, 01:12 AM
Authorized User
Join Date: Dec 2007
Posts: 65
Thanks: 9
Thanked 2 Times in 2 Posts
Send a message via AIM to sandeepgreaternoida Send a message via MSN to sandeepgreaternoida Send a message via Yahoo to sandeepgreaternoida
Default chp 01, get[property name] and set[property name]


  class Demo {

    private $_name;

    public function sayHello() {
	 print "Hello ($this -> getName()}!";
	public function getName () {
     return $this -> _name;
	public function setName($name) {
	 if (!is_string($name) || strlen($name) == 0) { 
	  throw new Exception ("Invalid name value");
	  $this -> _name = $name;


  $objDemo = new Demo();
  $objDemo->name = 'Steve';

  $objDemo ->sayHello();
  $objDemo -> setName(37); //would trigger an error


i tried to type exactly the same code as in the Book.

when i open test.demo.php in the browser..it does not work.
is there any problems with codes.

thanx in advance !
sandeep gupta

Last edited by sandeepgreaternoida; May 12th, 2009 at 01:29 AM.. Reason: change public to private

Similar Threads
Thread Thread Starter Forum Replies Last Post
This property can not be set for anonymous users everest ASP.NET 2.0 Professional 2 April 19th, 2008 04:28 AM
Get Set Property value being lost asn187 ASP.NET 2.0 Professional 1 April 19th, 2007 03:09 PM
Chp.12 SqlDataSourceView 'owner' property studen77 BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 0 March 6th, 2007 02:58 PM
Set accountExpires property r_ganesh76 C# 0 August 9th, 2006 01:16 AM
VB Property Set question amytys1 VB How-To 2 June 25th, 2004 05:35 PM

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