Skip to content

Commit

Permalink
Fix array_fill example (#8138)
Browse files Browse the repository at this point in the history
Fix: Use correct parameter name "count" instead of "num" in array_fill()

Updated the array_fill() function to use "count" as the second parameter, aligning with the official PHP documentation.
  • Loading branch information
DombleGames authored Jan 30, 2025
1 parent ec8a091 commit 6f10879
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Named arguments in PHP, introduced with PHP 8.0, allow you to specify the values

```php
<?php
$a = array_fill(start_index: 0, num: 100, value: 50);
$a = array_fill(start_index: 0, count: 100, value: 50);
```

In this code snippet, the parameters are passed by their names ('start_index', 'num', 'value'), not by their order in the function definition.
In this code snippet, the parameters are passed by their names ('start_index', 'count', 'value'), not by their order in the function definition.

Visit the following resources to learn more:

- [@official@Named Arguments](https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments)
- [@official@Named Arguments](https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments)

0 comments on commit 6f10879

Please sign in to comment.