PHP - read variables from a array string field

dumbtech

New Member
I have a array that looks like this:\[code\] $sites = array('Twitter' => 'http://twitter.com/home?status=$status', 'Digg' => 'http://digg.com/submit?phase=2&title=$title', .... ); $status = 'bla bla'; $title = 'asdasf'; foreach($sites as $site_name=>$site_url) echo '<li><a href="'.$site_url.'">'.$site_name.'</a></li>';\[/code\]Notice the $status and $title keywords in the array fields. Is there any way I can "map" these keywords to variables I set below?so the output would be:\[code\]<li><a href="http://twitter.com/home?status=bla bla">Twitter</a></li>';\[/code\]
 
Back
Top