problemas con str_replace en php5

[email protected] ("Omar Steffen")
Newsgroups php.general.es
Message-ID <24C9FAD045F24B02B42C548C46FF212A@omar>
Hola amigos espero me puedan dar una mano, tengo este script que corre en php 4 sin problemas pro no me muestra las imagenes en php5 y no le encuentro el error, espero respuesta, desde ya muchas gracias

<?php
//================Aca empieza el baile " Busco y reemplazo #i " =============
$texto=$row_rstrabajos['nota'];
$i=1;
$x=2;
$string1="#$i#";
$imagen=$row_rstrabajos['imagen'];
$string2="<center><img src=\"imagenes/noticias/$imagen\"></center>";
$texto = str_replace ($string1, $string2,  $texto);
for ($i = 2; $i <= 10; $i++) {
$string1="#$i#";
$imagen=$row_rstrabajos['imagen$x'];
$string2="<center><img src=\"imagenes/noticias/$imagen\"></center>";
$texto = str_replace ($string1, $string2,  $texto);
$x=++$x;
}
echo $texto;
//================Aca termina el baile " Busco y reemplazo #i " =============
?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.