Imdb\Title::get_admissions PHP Method

get_admissions() protected method

Get admissions budget
See also: IMDB page / (TitlePage)
protected get_admissions ( &$listAdmissions ) : array[0..n]
return array[0..n]
    protected function get_admissions(&$listAdmissions)
    {
        $result = array();
        $temp = $listAdmissions;
        $i = 0;
        while ($temp != NULL) {
            // Tries to get a single entry
            if (@preg_match("!(.*?)<br/>!ims", $temp, $adm)) {
                $entry = $adm[1];
            }
            // Tries to extract the value
            if (@preg_match("!(.*?)\\(!ims", $adm[1], $value)) {
                $adm[1] = str_replace($value, "", $adm[1]);
            }
            // Tries to extract the country
            if (@preg_match("!(.*?)\\)\\s*!ims", $adm[1], $country)) {
                $adm[1] = str_replace($country, "", $adm[1]);
            }
            // Tries to extract the date
            if (@preg_match("!\\((.*?)\\)\\s*!ims", $adm[1], $date)) {
                if (@preg_match("!<a href=\"/date/(.*?)/\">!ims", $date[1], $dayMonth)) {
                    if (@preg_match("!<a href=\"/year/(.*?)/\">!ims", $date[1], $year)) {
                        $dateValue = $year[1] . '-' . $dayMonth[1];
                    }
                }
            }
            $adm[1] = str_replace($date, "", $adm[1]);
            // Parse the results in an array
            $result[$i] = array('value' => intval(str_replace(",", "", $value[1])), 'country' => $country[1], 'date' => $dateValue);
            // Remove the entry from the list of entries
            if (@preg_match("!<br/>(.*?)\$!ims", $temp, $temp)) {
                $temp = $temp[1];
            }
            $i++;
        }
        return $result;
    }