www.webdeveloper.com
Results 1 to 5 of 5

Thread: php help: convert a , into a .

  1. #1
    Join Date
    Feb 2014
    Posts
    3

    php help: convert a , into a .

    Hi,
    how can I convert an input: $num1 = $_POST['num1'];
    Say someone enters 1,5 and I want this to convert to 1.5

    How can I do this?

    Thanks for your time

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,637
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Feb 2014
    Posts
    3
    Gr8t

    Thank you

  4. #4
    Join Date
    Feb 2014
    Location
    Canada
    Posts
    155
    PHP Code:
    $conv str_replace(",""."$num1);
    echo(
    $conv); // to test it out 

  5. #5
    Join Date
    Feb 2014
    Posts
    3
    works perfectly, thanks a million

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles