Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] Question on arrays as properties [RSS Feed]

#1 Oct. 28, 2005 06:10:29

Bob S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Question on arrays as properties


Hi,



Am I correct in saying that a class property cannot be initialized to an
array? Looking at zend_declare_property

it clearly states that Internal zvals cant be arrays.



So how would I go about creating the following inherited property in all my
subclasses if my core class has this property?





class ZObject {



protected $_props = array();





.





}



class ZString {



public function __construct()

{

$this->setProperty($name, $value)

}

public function setProperty($name, $value)

{

$this->_props;

}



}



In other words, how would I create a property that is an array (in C) where
that property is available to all my subclasses WITHOUT

initializing it manually in the __construct, which would force each subclass
constructor to call its parent (while good design, I'd prefer

not to have this constraint).





Thanks



Bob Silva

Offline

  • Root
  • » PHP
  • » [PHP-DEV] Question on arrays as properties [RSS Feed]

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support