#!/usr/bin/php /ms','',$data); # cut data after table $data = preg_replace('/<\/tbody>.*$/ms','',$data); # split in to rows preg_match_all('/