Jump to content


Photo

Remove commas from string.


  • Please log in to reply
2 replies to this topic

#1 dreampho

dreampho

    Advanced Member

  • Members
  • PipPipPip
  • 96 posts

Posted 05 February 2013 - 02:52 AM

Hi. I am currently removing the currency symbol from my string, which is in this case 'R'. I want to also remove any commas, how can I do this?

$deposit = str_replace('R','',$deposit);

Thank you.

#2 kicken

kicken

    Wiser? Not exactly.

  • Gurus
  • 2,785 posts
  • LocationBonita, FL

Posted 05 February 2013 - 03:15 AM

You can pass an array of values to str_replace and it will replace each one
str_replace(array('R', ','), '', $deposit);

Recycle your old CD's, don't trash them!
Did I help you out?  Feeling generous? I accept tips via Paypal or Bitcoin @ 14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7

#3 dreampho

dreampho

    Advanced Member

  • Members
  • PipPipPip
  • 96 posts

Posted 05 February 2013 - 03:49 AM

Thank you!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com