Skip to content
Quiz · Arrays · lesson 3 of 8

Quiz — keys, order and a missing key

Question 1 of 2

What does the program print?

PHP
<?php

$stock = ['pear' => 2, 'apple' => 5];
$stock['kiwi'] = 1;
$stock['pear'] = 7;
unset($stock['apple']);
foreach ($stock as $fruit => $qty) {
    echo $fruit, '=', $qty, ' ';
}
echo count($stock), "\n";