<?php declare(strict_types=1); // the array argument is copied on entry function appendZero(array $v): void { $v[] = 0; } $nums = [1, 2]; appendZero($nums); // caller's array is untouched print_r($nums);
a function gets its own copy