Re: PHP Tips and Tricks Don't use a regex if you don't have to
PHP has a rich set of string manipulation functions - use them!
BAD: <? $new = ereg_replace("-","_",$str); ?>
GOOD:<? $new = str_replace("-","_",$str); ?>
BAD: <? preg_match('/(\..*?)$/',$str,$reg);?>
GOOD:<? substr($str,strrpos($str,'.')); ?>
__________________ Thanks & Regards
Sabari... |