Found Code: Replacing Runs of Commas
January 27, 2009 – 3:47 pmI found this gem today.
$special = str_replace(”,,,,”,”,”,$special);
$special = str_replace(”,,,”,”,”,$special);
$special = str_replace(”,,”,”,”,$special);
Pretty sweet.
Tech Thoughts, Mostly on LAMP – by Jon Haddad
I found this gem today.
$special = str_replace(”,,,,”,”,”,$special);
$special = str_replace(”,,,”,”,”,$special);
$special = str_replace(”,,”,”,”,$special);
Pretty sweet.
2 Responses to “Found Code: Replacing Runs of Commas”
Three replaces? try
$special = preg_replace(”/,,*/”,”,”,$special);
By JDS on Jan 29, 2009
I think you missed the point of my post. I was posting a block of ridiculous code that I found while working on a web site.
By jon on Jan 30, 2009