Prototype:

function array_fill( int $start_index, int $num, mixed $value ): array|false {}
Code:


<?php
try {
    var_dump(array_fill(0, -100, "foobar"));
} catch( Throwable $e ) {
    echo get_class( $e ), ': ', $e->getMessage();
}
?>
PHP 7.4:

Warning: array_fill(): Number of elements can't be negative
PHP 8.0:

ValueError: array_fill(): Argument #2 ($num) must be greater than or equal to 0