Found Code: Replacing Runs of Commas

January 27, 2009 – 3:47 pm

I found this gem today.

$special = str_replace(”,,,,”,”,”,$special);
$special = str_replace(”,,,”,”,”,$special);
$special = str_replace(”,,”,”,”,$special);

Pretty sweet.

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  1. 2 Responses to “Found Code: Replacing Runs of Commas”

  2. Three replaces? try

    $special = preg_replace(”/,,*/”,”,”,$special);

    By JDS on Jan 29, 2009

  3. 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

Post a Comment