Image

Imageshadesogrey wrote in Imagephp

preg_split help

I'm trying to split a block of text into words using preg_split as follows
$words = preg_split("[\s]+", $input, -1, PREG_SPLIT_DELIM_CAPTURE);


Using this syntax works for capturing other delimiters, but doesn't seem to work for capturing whitespaces.
ie.
"\tThis is a   string"
gives
{"This", "is", "a", "string"}

instead of
{"\t", "This", " ", "is", " ", "a", "   ", "string"}

I've tried a number of variations like
(\s), \ \
on the regex all without success.

[edit] resolved using "/(\s+)/"