Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    142
    Thanks
    9
    Thanked 1 Time in 1 Post

    How do you convert a blank space to a character?

    What code would I use to convert a blank space in a query to a character, namely a period.

    I want to parse this:

    sample query text or possibly numbers

    to this:

    sample.query.text.or.possibly.numbers

    I wouldn't need periods before or after the query.

    Can anyone fill me in on this?

  • #2
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,389
    Thanks
    8
    Thanked 1,077 Times in 1,068 Posts
    <?php
    $string="sample query text or possibly numbers";
    $string=str_replace(" ", ".", $string);
    echo $string;
    ?>

    result is:
    sample.query.text.or.possibly.numbers

  • #3
    Regular Coder
    Join Date
    Jan 2007
    Posts
    142
    Thanks
    9
    Thanked 1 Time in 1 Post
    Quote Originally Posted by mlseim View Post
    <?php
    $string="sample query text or possibly numbers";
    $string=str_replace(" ", ".", $string);
    echo $string;
    ?>

    result is:
    sample.query.text.or.possibly.numbers
    Much obliged.


  •  

    Posting Permissions

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