I’m trying to use either split, preg_split, or explode to parse the following data into an array so that I can easily print and modify the data:
28782188 /var/opt
When I run
print_r(preg_split('/ /', $input));
All I get is
Array ( [0] => 28782796 /var/opt )
Is there a way to make php split with the whitespace that I’m getting from my du calls?
I think you want
To split by any white-space character – du seperates with tabs (
\t) if I remember right, although don’t quote me on that…EDIT Changed regex to one that works…