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
    Nov 2010
    Location
    Washington DC
    Posts
    341
    Thanks
    22
    Thanked 1 Time in 1 Post

    Strip a word from a variable

    Hello:

    I'm trying to strip a word out of a variable and echo it out. here is what I mean:

    PHP Code:
    $from 
    the value of which is INTERVAL 7 DAY

    I have this line that includes the variable:

    PHP Code:
    echo"The total number of transaction(s) found within the last $from: "; echo $row["numrecords"]; echo"<br/>"
    Currently this line would echo as:

    "The total number of transaction(s) found within the last INTERVAL 7 DAY: 25"

    What I really want to happen is:

    "The total number of transaction(s) found within the last 7 DAY: 25"

    Essentially I want to strip INTERVAL out at the echo line. Is this doable? If so any guidance is most appreciative.

    Mossa

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Take a look into str_replace()
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Nov 2010
    Location
    Washington DC
    Posts
    341
    Thanks
    22
    Thanked 1 Time in 1 Post
    Resolved!

    PHP Code:
    <?php
        $new_from 
    substr($from8);
        echo 
    $new_from;
    ?>
    did the job


  •  

    Posting Permissions

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