suffixSwap function
| From: | Theodore Jones | Date: | Fri, 06 Oct 2000 04:25:53 +0000 |
| Subject: | suffixSwap function | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-18828@lists.php.net to get a copy of this message | ||
Hey all,
I've go this function:
function suffixSwap($nameString, $x) {
$pattern = ".";
$arr = split($pattern, $nameString);
echo ($arr[0]) . $x;
}
which should take a file name like "stardust.jpg" and tack on a new suffix
".mpg" to make "stardust.mpg". I'm trying to split my functions passwed
string (nameString), by matching the patter ".", but can't seem to get it to
work?
Anyone know what could be going on. It just spits out ".mpg" for every
value I try with my function call:
suffixSwap("stardust.jpg", ".mpg")
Thanks much if anyone can offer pointer on my regular expression use...?
~ Theo