PHP每个网址只有一个结果

I am using this code below but although I have the same domain twice only one output it echoing on the page.

$urls = array(
    'phpclasses.org' => 'phpclass',
    'phpclasses.org' => 'php',
    'php.com' => 'php'
);

$RankChecker=new RankChecker(1,5);

foreach($urls as $url => $keyword) {
    $result=$RankChecker->find($url,$keyword);

    if ($result!==false) {

        echo $url . " is found at page number  ".$result["page"].".";
        echo '<br>';

    } 
}

I need to be able to use same url multiple times.

Why is this not working on the code above?

You can't have an array with the same key twice. How would you access the value you wanted by key if it wasn't unique?

You need to try some other structure for your array.

E.g

$urls = array(
    0 => array('url' => 'phpclasses.org', 'keyword' => 'phpclass'),
    1 => array('url' => 'phpclasses.org', 'keyword' => 'php'),
    2 => array('url' => 'php.com', 'keyword' => 'php')
);

Then you would need to call your function like $result=$RankChecker->find($keyword['url'],$keyword['keyword']); in the loop.

You are overwriting the value of the key 'phpclasses.org'. Doing

$urls = array(
    'phpclasses.org' => 'phpclass',
    'phpclasses.org' => 'php'
);

is essentially the same as

$urls = array(
    'phpclasses.org' => 'phpclass'
);
$urls['phpclasses.org'] = 'php';

In the end, there will only be one key for 'phpclasses.org' in the array

Think about changing it to a multidimensional array, removing the dependance on the key