simple PHP integer conversion

Posted by Ygam on Stack Overflow See other posts from Stack Overflow or by Ygam
Published on 2010-03-24T02:56:32Z Indexed on 2010/03/24 3:03 UTC
Read the original article Hit count: 451

Filed under:

convert this: $300 to this : 300

  • can't do it with intval() or (int) typecasting
  • if the non-numerical character is suffixed (300$), both works and returns 300
  • if it is prefixed it returns 0
  • the non-numerical character can be anything other than the "$"(i.e. "askldjflksdjflsd")

Please help

© Stack Overflow or respective owner

Related posts about php