Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Split a string in 2 and add a span tag to the first word
$originalString = "Test String";
$stringInParts = explode(' ', $originalString);
$originalString = '<span>' . $stringInParts[0] . '</span>' . Implode(" ", array_slice($stringInParts,1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.