protected function get_weekendGross(&$listweekendGross)
{
$result = array();
$temp = $listweekendGross;
$i = 0;
while ($temp != NULL) {
// Tries to get a single entry
if (@preg_match("!(.*?)<br/>!ims", $temp, $weGr)) {
$entry = $weGr[1];
}
// Tries to extract the value
if (@preg_match("!(.*?)\\(!ims", $weGr[1], $value)) {
$weGr[1] = str_replace($value, "", $weGr[1]);
}
// Tries to extract the country
if (@preg_match("!(.*?)\\)\\s*!ims", $weGr[1], $country)) {
$weGr[1] = str_replace($country, "", $weGr[1]);
}
// Tries to extract the date
if (@preg_match("!\\((.*?)\\)\\s*!ims", $weGr[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];
}
}
}
$weGr[1] = str_replace($date, "", $weGr[1]);
// Tries to extract the number of screens
if (@preg_match("!\\((.*?)\\)\\s*!ims", $weGr[1], $nbScreen)) {
$weGr[1] = str_replace($nbScreen, "", $weGr[1]);
}
// Parse the results in an array
$result[$i] = array('value' => trim($value[1]), 'country' => $country[1], 'date' => $dateValue, 'nbScreens' => intval(str_replace(",", "", $nbScreen[1])));
// Remove the entry from the list of entries
if (@preg_match("!<br/>(.*?)\$!ims", $temp, $temp)) {
$temp = $temp[1];
}
$i++;
}
return $result;
}