> I don't want to parse variables FROM a string but I want to parse them
> INTO a string as described on the page: 
> 
> http://ie.php.net/manual/en/language.types.string.php#language.types.string.parsing
> 
> Below a PHP example that shows the function I want.
> 
> <?php
> 
>   $abc        = '123';
>   $klm['klm'] = '456';
>   $xyz->xyz   = '789';
> 
>   $string = '* {$abc} * {$klm[\'klm\']} * {$xyz->xyz} *';
> 
>   $result = parseVarsIntoString ($string);  
> 
>   echo $result;
>   
>   function parseVarsIntoString ($string) {
>     
>     extract($GLOBALS);
> 
>     eval('$result = "' . str_replace('"', '\\"', $string) . '";');
> 
>     return $result;
> 
>   }

Just use double quotes, no need for a function:

  $string = "* {$abc} * {$klm['klm']} * {$xyz->xyz} *";
  echo $string;

Consider rereading that manual page.

Regards,
Philip

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to