PHP - check if a string has 2 words, and if true append a html tag to the 2nd one

mnmYoooesq

New Member
Whats the fastest possible way to do this?I think the code below works, but I'm sure there's a faster way to achieve what I want:\[code\]$words = explode(" ", $string);if(!empty($words[1]) $words[1] = '<span>'.$words[1].'</span>';$string = implode(" ", $words);\[/code\]What do you think?
 
Back
Top