0

I'm getting an undefined offset error

<?php    

function ara($one, $two, $three)
{
    @preg_match_all('/' . preg_quote($one, '/') .
                    '(.*?)'. preg_quote($two, '/').'/i', $three, $m);
    return @$m[1];
}

$link = "example.com";
$article = file_get_contents($link);

$sport = ara('data-bin="','"',$article);
$channel = ara('data-videobin="','"',$article);
for ($i=0;$i<50;$i++)
    echo"<span class='linko'><a target='_blank' href='example.org/live1.php?id=".($channel[$i]."'>$sport[$i]</a>"."<br></span>"); // error is here

?>

How can I fix it? I'am waiting for your helps. Thanks.

These codes are for a live channel website.

1 Answers1

0

The channel variable has less than 50 elements. Usually in a loop, you should set the end condition to the size of the array.

for ($i=0;$i<sizeof($channel);$i++)
Ami Heines
  • 480
  • 7
  • 17