phppreg-replaceeregi

Eregi_replace to preg_replace conversion needed


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


Solution

  • $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.