Skip to content
Quiz · Functions · lesson 7 of 11

Quiz — an array inside a function

Question 1 of 2

What does the program print?

PHP
<?php

function push(array $list, string $x)
{
    $list[] = $x;
    return count($list);
}

$cart = ['tea'];
$n = push($cart, 'milk');
echo $n, ' ', count($cart), "\n";