Imdb\Title::get_table_rows PHP Method

get_table_rows() protected method

Get rows for a given table on the page
See also: used by the methods director, cast, writing, producer, composer
protected get_table_rows ( $html, $table_start ) : array | false
return array | false rows (FALSE if table not found, array[0..n] of strings otherwise)
    protected function get_table_rows($html, $table_start)
    {
        if ($table_start == "Writing Credits" || $table_start == "Series Writing Credits") {
            $row_s = strpos($html, ">" . $table_start);
        } else {
            $row_s = strpos($html, ">" . $table_start . "&nbsp;<");
        }
        $row_e = $row_s;
        if ($row_s == 0) {
            return FALSE;
        }
        $endtable = strpos($html, "</table>", $row_s);
        $block = substr($html, $row_s, $endtable - $row_s);
        if (preg_match_all('!<tr>(.+?)</tr>!ims', $block, $matches)) {
            $mc = count($matches[1]);
            /* for ($i=0;$i<$mc;++$i) if ( strncmp( trim($matches[1][$i]), "<td valign=",10) == 0 ) $rows[] = $matches[1][$i]; */
            $rows = $matches[1];
        }
        return $rows;
    }