You are here: Re: having trouble with string replacement « PHP Programming Language « IT news, forums, messages
Re: having trouble with string replacement

Posted by laredotornado on 11/04/05 21:53

I actually want the result string (what is printed to the browser) to
look like

param1=abcd&agency_id=<?php echo $LTON; ?>&param2=dex

This PHP code:

<?php
$str = "&mine=20&agency_id=234&test=abc";
$search = "/agency_id=\\d+/i";
$replace = "agency_id=<?php echo \$LTON; ?>";
$retVal = preg_replace($search, $replace, $str);
print $retVal;
?>

regrettably produces the wrong result

&mine=20&agency_id=&test=abc

How can I heal the pain? Thanks, - Dave

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация