Skip to main content
added 16 characters in body
Source Link
dev-null-dweller
  • 29.4k
  • 3
  • 67
  • 87

My head is spinning, I tried to do this on my own, but cant figure it out. so once again I will turn to your guys knowledge.

These all are my possible my strings:

My head is spinning with, pregreplace My head is spinning, with, pregreplace My head is, spinning, with, pregreplace My head, is, spinning, with, pregreplace

My head is spinning with, pregreplace
My head is spinning, with, pregreplace
My head is, spinning, with, pregreplace
My head, is, spinning, with, pregreplace

(Notice commas in above strings)

I want to have all "preg-replaced" / "string-replaced" with only one comma at the end.(Just like displayed on first example)

My head is spinning with, pregreplace

Thanks in advance ;)

My head is spinning, I tried to do this on my own, but cant figure it out. so once again I will turn to your guys knowledge.

These all are my possible my strings:

My head is spinning with, pregreplace My head is spinning, with, pregreplace My head is, spinning, with, pregreplace My head, is, spinning, with, pregreplace

(Notice commas in above strings)

I want to have all "preg-replaced" / "string-replaced" with only one comma at the end.(Just like displayed on first example)

My head is spinning with, pregreplace

Thanks in advance ;)

My head is spinning, I tried to do this on my own, but cant figure it out. so once again I will turn to your guys knowledge.

These all are my possible my strings:

My head is spinning with, pregreplace
My head is spinning, with, pregreplace
My head is, spinning, with, pregreplace
My head, is, spinning, with, pregreplace

(Notice commas in above strings)

I want to have all "preg-replaced" / "string-replaced" with only one comma at the end.(Just like displayed on first example)

My head is spinning with, pregreplace

Thanks in advance ;)

Source Link
Ossi
  • 798
  • 2
  • 14
  • 21

Remove commas except last one w preg_replace

My head is spinning, I tried to do this on my own, but cant figure it out. so once again I will turn to your guys knowledge.

These all are my possible my strings:

My head is spinning with, pregreplace My head is spinning, with, pregreplace My head is, spinning, with, pregreplace My head, is, spinning, with, pregreplace

(Notice commas in above strings)

I want to have all "preg-replaced" / "string-replaced" with only one comma at the end.(Just like displayed on first example)

My head is spinning with, pregreplace

Thanks in advance ;)