Jump to content


Photo

Remove commas from string.


  • Please log in to reply
2 replies to this topic

#1 dreampho

dreampho
  • Members
  • PipPipPip
  • Advanced Member
  • 96 posts

Posted 05 February 2013 - 07: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
  • Gurus
  • Wiser? Not exactly.
  • 3,207 posts
  • LocationBonita, FL

Posted 05 February 2013 - 08: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 Bitcoin @ 14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7

#3 dreampho

dreampho
  • Members
  • PipPipPip
  • Advanced Member
  • 96 posts

Posted 05 February 2013 - 08:49 AM

Thank you!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users