Re: Name of variable to string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/8/08, Eric Butera <eric.butera@xxxxxxxxx> wrote:
>
> On Feb 8, 2008 1:53 PM, David Giragosian <dgiragosian@xxxxxxxxx> wrote:
> > On 2/8/08, Richard Lynch <ceo@xxxxxxxxx> wrote:
> > >
> > > On Fri, February 8, 2008 9:14 am, tedd wrote:
> > > >  From a variable with the name of $this_variable -- how do I get a
> > > > string 'this_variable' ?
> > >
> > > You don't...
> > >
> > > Consider this:
> > >
> > > function foo($bar){
> > > //what would your function output?
> > > }
> > >
> > > $baz = 3;
> > > foo($baz);
> > >
> > > --
> >
> >
> > If you dynamically created the variable:
> >
> > ${ 'something' . '_' . 'somethingElse' };
> >
> > then you'd have access to it via the variable name parts.
> >
> > David
> >
>
> That is ridiculous.
>


This is what I meant, as was posted just yesterday by someone (Jim Lucas?)

for ( $i = 0 ; $i < 20 ; $i++ )
{

        $theVariableAsString = 'something_' . $i;

         ${ 'something' . '_' . $i } = "Assign something here";

}

String value available here -> $theVariableAsString.

I have no idea why tedd wants to have the string value of the variable nor
how he will use it.


David

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux