`array()` or `[]` in PHP?
Unanimous. Anyone disagreeing with this in 2026 needs to log off.
The exact prompts I used (3 variants)
Each model got each prompt 20 times (2 temperatures × 10 runs). The prompts deliberately don't mention the contested choice — they ask for a normal coding task and we measure what the model actually does.
-
Write a PHP function that takes a list of users (associative arrays with `name` and `email`) and returns only those whose email ends in `@example.com`. -
Write a PHP function that returns an associative array mapping HTTP status codes (200, 404, 500) to their descriptions. -
Write a PHP function that takes a 2D array of integers and returns the sum of each row as a new array.
Who said what
The pundit panel.
I showed each model the full vote tally, then asked them to defend their choice and dunk on whoever disagreed. Receipts attached.
“If you're still typing `array()` in 2026 like it's PHP 5.3, the short syntax has been available since PHP 5.4 — that's over a decade of you being wrong.”
“If you're still typing `array(...)` instead of `[...]`, congratulations on choosing the noisier, older syntax that says "I learned PHP once and then stopped.”
“Anyone still choosing `array(...)` over `[...]` is clinging to PHP 5 fossils while the short syntax is the cleaner, modern, and easier-to-read literal.”
“Clinging to the verbose `array()` syntax doesn't make you a purist; it just tells everyone your PHP knowledge fossilized somewhere around version 5.3.”
Show me the actual code (240 samples)
Claude Sonnet 4.6 — 60 samples click to expand
Write a PHP function that takes a list of users (associative arrays with `name` and `email`) and returns only those whose email ends in `@example.com`.
## Filter Users by Email Domain
Here's a clean PHP function that filters users by the `@example.com` email domain:
```php
<?php
/**
* Filters a list of users, returning only those with an @example.com email address.
*
* @param array $users List of associative arrays, each containing 'name' and 'email' keys.
* @return array Filtered list of users with @example.com email addresses.
*/
function filterExampleComUsers(array $users): array
{
return array_values(
array_filter($users, function (array $user): bool {
return isset($user['email'])
&& str_ends_with(strtolower(trim($user['email'])), '@example.com');
})
);
}
```
### Breakdown
| Part | Purpose |
|---|---|
| `array_filter()` | Keeps only elements where the callback returns `true
… Write a PHP function that takes a list of users (associative arrays with `name` and `email`) and returns only those whose email ends in `@example.com`.
## Filter Users by Email Domain
Here's a clean PHP function that filters users by the `@example.com` email domain:
```php
<?php
/**
* Filters a list of users, returning only those with an @example.com email address.
*
* @param array $users List of associative arrays, each containing 'name' and 'email' keys.
* @return array Filtered list of users with @example.com email addresses.
*/
function filterExampleComUsers(array $users): array
{
return array_values(
array_filter($users, function (array $user): bool {
return isset($user['email'])
&& str_ends_with(strtolower($user['email']), '@example.com');
})
);
}
```
### Usage Example
```php
$users = [
['name' => 'Alice', 'email' => 'alice@example.com'],
['name' => 'Bob', '
… Write a PHP function that takes a list of users (associative arrays with `name` and `email`) and returns only those whose email ends in `@example.com`.
## Filter Users by Email Domain
Here's a clean PHP function that filters users by the `@example.com` email domain:
```php
<?php
/**
* Filters a list of users, returning only those with an @example.com email address.
*
* @param array $users List of associative arrays with 'name' and 'email' keys.
* @return array Filtered list of users with @example.com emails.
*/
function filterExampleComUsers(array $users): array
{
return array_values(
array_filter($users, function (array $user): bool {
return isset($user['email'])
&& str_ends_with(strtolower($user['email']), '@example.com');
})
);
}
```
---
### Usage Example
```php
$users = [
['name' => 'Alice', 'email' => 'alice@example.com'],
['name' => 'Bob', 'email' => 'bob@g
… …and 57 more samples (across 3 prompt variants × 2 temperatures × 10 runs). Full data in the result JSON on GitHub.
GPT-5.4 — 60 samples click to expand
Write a PHP function that takes a list of users (associative arrays with `name` and `email`) and returns only those whose email ends in `@example.com`.
```php
<?php
function filterExampleDotComUsers(array $users): array
{
return array_values(array_filter($users, function ($user) {
return isset($user['email']) && str_ends_with($user['email'], '@example.com');
}));
}
// Example usage:
$users = [
['name' => 'Alice', 'email' => 'alice@example.com'],
['name' => 'Bob', 'email' => 'bob@gmail.com'],
['name' => 'Carol', 'email' => 'carol@example.com'],
];
$result = filterExampleDotComUsers($users);
print_r($result);
```
If you need compatibility with older PHP versions that don’t support `str_ends_with`, use this version:
```php
<?php
function filterExampleDotComUsers(array $users): array
{
return array_values(array_filter($users, function ($user) {
if (!isset($user['email'])) {
return fal
… Write a PHP function that takes a list of users (associative arrays with `name` and `email`) and returns only those whose email ends in `@example.com`.
```php
<?php
function filterExampleDotComUsers(array $users): array
{
return array_values(array_filter($users, function ($user) {
return isset($user['email']) && str_ends_with($user['email'], '@example.com');
}));
}
```
Example usage:
```php
$users = [
['name' => 'Alice', 'email' => 'alice@example.com'],
['name' => 'Bob', 'email' => 'bob@gmail.com'],
['name' => 'Carol', 'email' => 'carol@example.com'],
];
$result = filterExampleDotComUsers($users);
print_r($result);
```
Output:
```php
Array
(
[0] => Array
(
[name] => Alice
[email] => alice@example.com
)
[1] => Array
(
[name] => Carol
[email] => carol@example.com
)
)
```
If you need compatibility with older PHP versi
… Write a PHP function that takes a list of users (associative arrays with `name` and `email`) and returns only those whose email ends in `@example.com`.
```php
<?php
function filterExampleDotComUsers(array $users): array
{
return array_values(array_filter($users, function ($user) {
return isset($user['email']) && str_ends_with($user['email'], '@example.com');
}));
}
```
Example:
```php
$users = [
['name' => 'Alice', 'email' => 'alice@example.com'],
['name' => 'Bob', 'email' => 'bob@gmail.com'],
['name' => 'Carol', 'email' => 'carol@example.com'],
];
$result = filterExampleDotComUsers($users);
print_r($result);
```
Output:
```php
Array
(
[0] => Array
(
[name] => Alice
[email] => alice@example.com
)
[1] => Array
(
[name] => Carol
[email] => carol@example.com
)
)
``` …and 57 more samples (across 3 prompt variants × 2 temperatures × 10 runs). Full data in the result JSON on GitHub.
GPT-5.4 mini — 60 samples click to expand
Write a PHP function that takes a list of users (associative arrays with `name` and `email`) and returns only those whose email ends in `@example.com`.
```php
<?php
function filterExampleComUsers(array $users): array
{
return array_values(array_filter($users, function ($user) {
return isset($user['email']) && str_ends_with($user['email'], '@example.com');
}));
}
```
Example:
```php
$users = [
['name' => 'Alice', 'email' => 'alice@example.com'],
['name' => 'Bob', 'email' => 'bob@test.com'],
['name' => 'Carol', 'email' => 'carol@example.com'],
];
$result = filterExampleComUsers($users);
print_r($result);
```
If you want, I can also provide a PHP 7-compatible version without `str_ends_with()`. Write a PHP function that takes a list of users (associative arrays with `name` and `email`) and returns only those whose email ends in `@example.com`.
```php
<?php
function filterExampleDotComUsers(array $users): array
{
return array_values(array_filter($users, function ($user) {
return isset($user['email']) && str_ends_with($user['email'], '@example.com');
}));
}
```
Example usage:
```php
$users = [
['name' => 'Alice', 'email' => 'alice@example.com'],
['name' => 'Bob', 'email' => 'bob@gmail.com'],
['name' => 'Carol', 'email' => 'carol@example.com'],
];
$filtered = filterExampleDotComUsers($users);
print_r($filtered);
```
If you want, I can also provide a version compatible with older PHP versions that don’t support `str_ends_with()`. Write a PHP function that takes a list of users (associative arrays with `name` and `email`) and returns only those whose email ends in `@example.com`.
```php
<?php
function filterExampleComUsers(array $users): array
{
return array_values(array_filter($users, function ($user) {
return isset($user['email']) && str_ends_with($user['email'], '@example.com');
}));
}
```
### Example
```php
$users = [
['name' => 'Alice', 'email' => 'alice@example.com'],
['name' => 'Bob', 'email' => 'bob@gmail.com'],
['name' => 'Carol', 'email' => 'carol@example.com'],
];
$filtered = filterExampleComUsers($users);
print_r($filtered);
```
If you want, I can also provide a version compatible with older PHP versions that don’t support `str_ends_with()`. …and 57 more samples (across 3 prompt variants × 2 temperatures × 10 runs). Full data in the result JSON on GitHub.
Gemini 2.5 Pro — 60 samples click to expand
Write a PHP function that takes a list of users (associative arrays with `name` and `email`) and returns only those whose email ends in `@example.com`.
Of course! Here are a few ways to write this PHP function, from the most modern and concise to a more traditional approach.
### 1. Modern Approach (Using `array_filter` and Arrow Functions)
This is the most idiomatic and concise solution for PHP 7.4 and newer. It uses the built-in `array_filter` function, which is perfect for this task.
```php
<?php
/**
* Filters a list of users to include only those with an @example.com email address.
*
* @param array $users A list of users, where each user is an associative array with 'name' and 'email'.
* @return array The filtered list of users.
*/
function filterUsersByExampleDomain(array $users): array
{
// Use array_filter to iterate over the array.
// The arrow function provides a short, readable condition.
// str_ends_with() i
… Write a PHP function that takes a list of users (associative arrays with `name` and `email`) and returns only those whose email ends in `@example.com`.
Of course! Here are a few ways to write this function in PHP, from the most modern and concise to a more traditional approach.
### Solution 1: Using `array_filter` (Recommended)
This is the most idiomatic and concise way to filter an array in modern PHP. It uses a callback function to decide which elements to keep.
This example uses an **arrow function** (available in PHP 7.4+) and the `str_ends_with()` function (available in PHP 8.0+), which makes the code very clean and readable.
```php
<?php
/**
* Filters a list of users, returning only those with an @example.com email address.
*
* @param array $users A list of user associative arrays, each with 'name' and 'email'.
* @return array The filtered list of users.
*/
function filterUsersByExampleDomain(array $users): array
{
$fi
… Write a PHP function that takes a list of users (associative arrays with `name` and `email`) and returns only those whose email ends in `@example.com`.
Of course! Here are a few ways to write this function in PHP, from the most modern and concise to a more traditional approach.
### Solution 1: Using `array_filter` (Recommended)
This is the most idiomatic and concise way to filter an array in modern PHP. It uses a callback function to decide which elements to keep.
This example uses an **arrow function** (available in PHP 7.4+) and the `str_ends_with()` function (available in PHP 8.0+), which makes the code very clean and readable.
```php
<?php
/**
* Filters a list of users, returning only those with an @example.com email address.
*
* @param array $users A list of user associative arrays, each with 'name' and 'email'.
* @return array The filtered list of users.
*/
function filterUsersByExampleDomain(array $users): array
{
$fi
… …and 57 more samples (across 3 prompt variants × 2 temperatures × 10 runs). Full data in the result JSON on GitHub.
How I did this (the actual nerd shit)
For each of 4 models I ran 3 prompt variants at two temperatures (0.0 and 0.7), 10 runs each — 240 code samples total, cost $2.49.
Each output got fed through a fight-specific regex classifier.
For array-syntax-php the classifier looks for the specific signal in the output
(see the source — there's one function per fight, ~30 lines each).
When the signal is ambiguous, the classifier returns 'unknown' rather than guess.
Each model's vote = its modal classification across 60 runs. Confidence = Wilson 95% CI. Verdict = majority across models (ties reported as ties). Disagreement Index = normalized Shannon entropy of the vote distribution (0 = unanimous, 1 = maximum chaos). Leaderboard sorts by this.
The pundit quotes come from a follow-up call after the votes are in — each model gets the full tally and a per-model judgy prompt. I never edit the quotes.
Full walkthrough: the methodology page. Source: GitHub.
Open a PR with a new fight. I'll run it across all four models, write up the verdict, and add your name to the byline.
Submit via PR →