Domanda

i need to convert this in order to use preg_replace because eregi_replace is deprecated

$n=eregi_replace(")+.+","",$value);
$id=eregi_replace(".+)","<a hсref='http://www.company.com/product.php?id=".$n."'>",$value);
$newstr.="".$id."</a><br>";
//..... must be converted 

its very unclear to me how that would look in preg_replace

È stato utile?

Soluzione

$gexpieces = explode(")", $value);
$n=$gexpieces[0];//n is product id
unset($gexpieces[0]);
$prodname = implode($gexpieces);
$newstr.="<a href='http://www.company.com/product.php?id=".$n."'>".$prodname."</a><br/><br/>";

nevermind, done it myself.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top