problems getting vars read
Posted 04 October 2006 - 05:35 PM
But when I try to post the value with "echo 'meta_title = ', $meta_title ;"
which includes the $continent var inside $meta_title, I can't get the value to echo. it echoes
"Pay Per Click (PPC) For $continent" without the quotes.
I know I can do something like "getThing".$continent for this example but that wouldn't work well for others.
Can someone help me with this?
Posted 04 October 2006 - 07:50 PM
$string = $meta_title;
$pattern = '$continent';
$replacement = $continent;
echo preg_replace($pattern, $replacement, $string);
but I get this error - Warning: preg_replace(): No ending delimiter '$' found in .. line 108 (which is the echo preg... statement
If I echo each of the vars I get
string = Pay Per Click (PPC) Realestate Internet Marketing (RIM) For $continent
pattern = $continent
replacement = south_america
which seems right. If I can get "south_america" in the string in place of $continent I've got it.
There's suppose to be slashes in the preg statement, one place said #, but either one always gives me syntax errors.
Posted 04 October 2006 - 07:56 PM
I couldn't see how either of those would do it
<?php $meta_title = 'Pay Per Click (PPC) For $continent'; $continent = 'Australia'; echo str_replace('$continent', $continent, $meta_title); ?>
Posted 04 October 2006 - 08:00 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users