[nycphp-talk] Object Methods and Properties
Phillip Powell
phillip.powell at adnet-sys.com
Tue Jul 27 16:25:52 EDT 2004
Joe Crawford wrote:
>i have things like this
>
>class MyClass {
> var $_header;
> var $_body;
> var $_footer;
>}
>
>and i am trying to use that code to dynamically choose which variable to
>change.
>
>
I've had luck with PHP 4.3.2 doing this:
if ($append) $this->{'_' . $part} .= $val;
Phil
>Joe Crawford Jr.
>
>
>On Tue, 2004-07-27 at 16:11, Sol wrote:
>
>
>> > can anyone tell me why this code will not work>
>>
>>
>>>function setPart($part, $val, $append) {
>>> if(($part) && ($val)) {
>>> if($append) $this->_$part .= $val;
>>> else $this->_$part = $val;
>>> }
>>>}
>>>
>>>
>>if($this->_$part is declared as var $_part){
>>
>> $this->_$part should be $this->_part;
>>}
>>
>>=====
>>Sol Tour
>>PHPBTREE
>>http://phpbtree.com
>>
>>
>>
>>__________________________________
>>Do you Yahoo!?
>>Read only the mail you want - Yahoo! Mail SpamGuard.
>>http://promotions.yahoo.com/new_mail
>>_______________________________________________
>>New York PHP Talk
>>Supporting AMP Technology (Apache/MySQL/PHP)
>>http://lists.nyphp.org/mailman/listinfo/talk
>>http://www.newyorkphp.org
>>
>>
>>
>>
>
>_______________________________________________
>New York PHP Talk
>Supporting AMP Technology (Apache/MySQL/PHP)
>http://lists.nyphp.org/mailman/listinfo/talk
>http://www.newyorkphp.org
>
>
>
--
---------------------------------------------------------------------------------
Phil Powell
Multimedia Programmer
BPX Technologies, Inc.
#: (703) 709-7218 x107
Fax: (703) 709-7219
More information about the talk
mailing list