Splitting Strings Using Regular Expressions

Learn how to split strings using regular expressions with the help of examples.

We encountered PHP’s mb_str_split function and were using it to break an input string into an array of substrings, with each substring containing up to a certain amount of characters. We can accomplish the same thing using the split method on fluent string instances when supplying an integer argument. The following example splits our input string into an array of three substrings, each containing three characters:

Get hands-on with 1400+ tech skills courses.