NYCPHP Meetup

NYPHP.org

[nycphp-talk] Quick little question - variable interpolation

Analysis & Solutions danielc at analysisandsolutions.com
Thu Oct 17 17:05:56 EDT 2002


On Thu, Oct 17, 2002 at 04:24:28PM -0400, Adam Fields wrote:
> On Thu, Oct 17, 2002 at 04:01:52PM -0400, Analysis & Solutions wrote:
> 
> That is also not my question. I don't want to know how to assign a
> string such that variable interpolation happens. I want to know how to
> take an existing string and perform variable interpolation on it.

Oh.  I didn't understand your question.  Guess I was too busy working on 
other things to really pay attention to the whole thread.  Max was on 
target with eval().  So, continuing with my example...

  $one = 1;
  $two = 'this string = $one and that is it';
  $three = eval($two);
  echo $three;
  [results:  this string = 1 and that is it]

Now, BE CAREFUL about using eval().  You could do some really nasty things 
if the incoming string is corrupted by nasty persons.  Please read the PHP 
manual about eval() to make sure you're being safe.

--Dan

-- 
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409



More information about the talk mailing list