Jump to content

add a character before each word


Guest

Recommended Posts

function addToWords($string) {

$array = split(' ', $string);

foreach($array as $key=>$value) {
$array[$key] = '+'.$array[$key];
}

$return = implode (' ', $array);
}

Probably an easier way of doing it, best I could think of off the top of my head (without going into regex)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.