Skip to content

Instantly share code, notes, and snippets.

@EastSideCode
Created October 13, 2018 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EastSideCode/17870e1115587eb580cf69940898f042 to your computer and use it in GitHub Desktop.
Save EastSideCode/17870e1115587eb580cf69940898f042 to your computer and use it in GitHub Desktop.
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