[nycphp-talk] Object Methods and Properties
Joe Crawford
jcrawford at codebowl.com
Tue Jul 27 16:27:55 EDT 2004
Phill,
i will try your method now, thanks
Joe Crawford Jr.
On Tue, 2004-07-27 at 16:25, Phillip Powell wrote:
> 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
> >
> >
> >
>
More information about the talk
mailing list