...

View Full Version : Strip a word from a variable



mbarandao
12-04-2010, 04:33 PM
Hello:

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


$from the value of which is INTERVAL 7 DAY

I have this line that includes the variable:


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

abduraooft
12-04-2010, 04:39 PM
Take a look into str_replace() (http://php.net/str_replace)

mbarandao
12-04-2010, 07:39 PM
Resolved!


<?php
$new_from = substr($from, 8);
echo $new_from;
?>

did the job



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum