The example that you have shown,is a code that will read your SQL statement and tokenize with spaced in between and store each token in the array. If you are looking for the such pice of code, you can make that with split functions in php:
http://ca.php.net/split