On Monday 26 July 2004 10:09, Turbo wrote:

> I have array variable and string variable.
> I want to replace value of array by key of array  in string variable
> with preg_replace().
>
> Example :
> $message=array(
> 'name'=>'My Computer',
> 'version'=>'1.0'
> );
> $strValue="I am $name,build version $version\n";
>
> How's to replace?

I'm not sure what you're trying to do. Could you elaborate? In particular 
where does preg_replace() fit in?

It seems you want $strValue to be "I am My Computer,build version 1.0\n". If 
so:

1) you have completely misunderstood what preg_replace() is for
2) Use:
  $strValue="I am {$message['name']},build version {$message['version']}\n";
3) see manual > Types > Strings > 'Complex syntax'

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
A woman without a man is like a fish without a bicycle.
Therefore, a man without a woman is like a bicycle without a fish.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to