Inner workings of array_push and count

In PHP, for adding a value to (the end of) an array, there’s the array_push function.
But, would it behave like array_append from this code?

function array_append(&$arr,...$vals){
    foreach($vals as $val)
        $arr[count($arr)]=$val;
}

Also, would count behave like elem_quantity from this code?

function elem_quantity($a,$m=0){
    if(!is_array($a)) return 1;
    $o=0;
    foreach($a as $e)
        if($m)
            $o+=elem_quantity($a);
        else
            $o++;
    return $o;
}

Thanks for reaching out.

Edit: As @deceze have pointed out:

  1. (The previous) array_append wouldn’t work in some cases. Would this array_append behave like array_push?
function array_append(&$arr,...$vals){
    $i=0;
    foreach($arr as $k => $v)
        if(is_numeric($k)&&$k>$i) $i=$k;
    foreach($vals as $val)
        $arr[$i++]=$val;
}
  1. Also, elem_quantity should pass $m when it recursively calls itself, so instead of
$o+=elem_quantity($a);

there should be:

$o+=elem_quantity($a,$m);

or

$o+=elem_quantity($a,1);