Jump to content

Better performance


artweber

Recommended Posts

Hi guys,

Have to remove all symbols, double spaces from text and add comma at the end of each word.

Did as follows below..but I think it can be done easiest way. Please advise.

 

$new = preg_replace('/[^a-zA-Z0-9\s]/', '', $tags_array['title']);
$new_string = preg_replace('/\s{2}/',' ', $new);
$string = preg_replace('/[^a-zA-Z0-9]/', ',', $new_string);

 

 

Link to comment
https://forums.phpfreaks.com/topic/242294-better-performance/
Share on other sites

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.