PHP Neat Comma-Delimited Lisrt

  • Status Closed
  • Budget $30 - $250 USD
  • Total Bids 27

Project Description

I need a small bit of PHP code to take a comma-delimited inline list, determine the last item in the list, delete the last comma and insert the word "and" before the final item in the list.

For example, if I have a string that is "A, B, C, D" I would like the PHP function to take the string and return "A, B, C and D".

If the string is "A, B" (two items only) I would like the function to take the string and return "A and B".

If the string is "A" then the original string should be left alone.

Get free quotes for a project like this
Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online