NYCPHP Meetup

NYPHP.org

[nycphp-talk] Quick little question - variable interpolation

Oktay Altunergil nyphp at altunergil.com
Thu Oct 17 15:50:32 EDT 2002


Hm.. "= $one" is not a variable.. I don't know how you would treat it as one. I think you might be able to do something with 'variable variables'.

 http://www.php.net/manual/en/language.variables.variable.php

--oktay--

On Thu, 17 Oct 2002 15:28:44 -0400
Adam Fields <fields at surgam.net> wrote:

> On Thu, Oct 17, 2002 at 03:08:43PM -0400, Oktay Altunergil wrote:
> > $two = "= $one"  doesn't work?
> 
> It does. But it assumes I don't already have the string literal value
> of $two. Suppose I want to read in a string from a file or db that is
> stored as "= $one" and I want to interpolate it after reading it?
> 
> How do I do that?
> 
> > On Thu, 17 Oct 2002 14:50:55 -0400
> > Adam Fields <fields at surgam.net> wrote:
> > 
> > > This is one of those really easy questions that's difficult to search
> > > for because the search terms look like everything else.
> > > 
> > > Is there an easy way to do simple variable interpolation on a string?
> > > 
> > > For example, if I have:
> > > 
> > > $one = '1';
> > > $two = '= $one';
> > > 
> > > Is there a way to get $two to equal '= 1' (or whatever $one happens to
> > > contain, obviously)?
> > > 
> > > -- 
> > > 				- Adam
> > > 
> > > -----
> > > Adam Fields, Managing Partner, fields at surgam.net
> > > Surgam, Inc. is a technology consulting firm with strong background in
> > > delivering scalable and robust enterprise web and IT applications.
> > > http://www.adamfields.com
> > > 
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > 
> > 
> > 
> 
> -- 
> 				- Adam
> 
> -----
> Adam Fields, Managing Partner, fields at surgam.net
> Surgam, Inc. is a technology consulting firm with strong background in
> delivering scalable and robust enterprise web and IT applications.
> http://www.adamfields.com
> 
> 
> --- Unsubscribe at http://nyphp.org/list ---
> 
> 



More information about the talk mailing list