id) ) $Category_Lis" /> id) ) $Category_Lis" /> id) ) $Category_Lis"/>

eregi to preg_match replacement

19 views Asked by At

I am converting an old PHP4-5 script to make it PHP 7 compatible.

I have the following line:

if ( eregi('^'.$_POST["category"],$r->id) ) $Category_List .= (' selected ');

Can I simply do this?

if ( preg_match('^'.$_POST["category"],$r->id) ) $Category_List .= (' selected ');

or do I need to do this?

if ( preg_match('"/^('.$_POST["category"],$r->id).')/"i' ) $Category_List .= (' selected ');
0

There are 0 answers