Tabs vs spaces (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 validates an email address using a regex and returns a boolean. -
Write a PHP class `ShoppingCart` with methods to add an item, remove an item, and get the total. -
Write a PHP function `slugify($string)` that converts a title into a URL-safe slug.
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 using tabs in PHP, you're not just wrong — you're actively fighting PSR-2, PSR-12, and every major framework's coding standard, which means you've chosen chaos over consistency for no reason.”
“If you indent PHP with tabs, congratulations on choosing invisible chaos over PSR-compliant spaces—the rest of us like code that aligns everywhere, not just on your cursed editor.”
“Tabs in PHP are for people who enjoy chaotic diffs and inconsistent indentation; spaces keep PSR-12 readable, stable, and not embarrassing.”
“Anyone still using tabs must enjoy their code looking like a shattered mess on GitHub, because spaces guarantee consistent, universal alignment.”
Show me the actual code (240 samples)
Claude Sonnet 4.6 — 60 samples click to expand
Write a PHP function that validates an email address using a regex and returns a boolean.
## Email Validation Function in PHP
### Basic Implementation
```php
<?php
/**
* Validates an email address using regex.
*
* @param string $email The email address to validate.
* @return bool Returns true if valid, false otherwise.
*/
function validateEmail(string $email): bool
{
// Trim whitespace from the email
$email = trim($email);
// Return false if email is empty
if (empty($email)) {
return false;
}
// Regex pattern for email validation
$pattern = '/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/';
return (bool) preg_match($pattern, $email);
}
```
---
### Regex Pattern Breakdown
| Part | Description |
|------|-------------|
| `^` | Start of string |
| `[a-zA-Z0-9._%+\-]+` | Local part: letters, digits, and special chars (`._%+-
… Write a PHP function that validates an email address using a regex and returns a boolean.
## Email Validation Function in PHP
### Basic Implementation
```php
<?php
/**
* Validates an email address using regex.
*
* @param string $email The email address to validate.
* @return bool Returns true if valid, false otherwise.
*/
function validateEmail(string $email): bool
{
// Trim whitespace from the email
$email = trim($email);
// Return false if email is empty
if (empty($email)) {
return false;
}
// Regex pattern for email validation
$pattern = '/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/';
return (bool) preg_match($pattern, $email);
}
```
---
### Regex Pattern Breakdown
| Part | Pattern | Description |
|------|---------|-------------|
| Start | `^` | Beginning of string |
| Local part | `[a-zA-Z0-9._%+\-]+` | Letters,
… Write a PHP function that validates an email address using a regex and returns a boolean.
## Email Validation Function in PHP
### Basic Implementation
```php
<?php
/**
* Validates an email address using regex.
*
* @param string $email The email address to validate.
* @return bool Returns true if valid, false otherwise.
*/
function validateEmail(string $email): bool
{
$pattern = '/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/';
return (bool) preg_match($pattern, trim($email));
}
```
---
### Regex Breakdown
| Pattern Part | Description |
|----------------------|--------------------------------------------------|
| `^` | Start of string |
| `[a-zA-Z0-9._%+\-]+` | Local part (letters, digits, special chars) |
| `@` | Literal `@` symbol
… …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 validates an email address using a regex and returns a boolean.
```php
<?php
function isValidEmail(string $email): bool
{
return preg_match('/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/', $email) === 1;
}
// Example usage:
var_dump(isValidEmail('test@example.com')); // true
var_dump(isValidEmail('invalid-email')); // false
```
Note: Regex-based email validation is useful for basic checks, but `filter_var($email, FILTER_VALIDATE_EMAIL)` is usually a better built-in option in PHP for real-world use. Write a PHP function that validates an email address using a regex and returns a boolean.
```php
<?php
function isValidEmail(string $email): bool
{
return preg_match('/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/', $email) === 1;
}
```
Example:
```php
var_dump(isValidEmail('test@example.com')); // true
var_dump(isValidEmail('invalid-email')); // false
```
If you want, I can also provide:
- a stricter regex
- a version using `filter_var()`
- a version that supports more edge cases from RFC email formats Write a PHP function that validates an email address using a regex and returns a boolean.
```php
<?php
function isValidEmail(string $email): bool
{
return preg_match('/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/', $email) === 1;
}
```
Example:
```php
var_dump(isValidEmail('test@example.com')); // true
var_dump(isValidEmail('invalid-email')); // false
```
Note: Regex-based email validation is fine for simple checks, but `filter_var($email, FILTER_VALIDATE_EMAIL)` is usually a better built-in option in PHP. …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 validates an email address using a regex and returns a boolean.
```php
function isValidEmail(string $email): bool
{
return (bool) preg_match('/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/', $email);
}
```
Example:
```php
var_dump(isValidEmail('test@example.com')); // true
var_dump(isValidEmail('bad-email')); // false
``` Write a PHP function that validates an email address using a regex and returns a boolean.
```php
function isValidEmail(string $email): bool
{
return (bool) preg_match(
'/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i',
$email
);
}
```
### Example
```php
var_dump(isValidEmail('test@example.com')); // true
var_dump(isValidEmail('bad-email')); // false
``` Write a PHP function that validates an email address using a regex and returns a boolean.
```php
function validateEmail(string $email): bool
{
$pattern = '/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i';
return (bool) preg_match($pattern, $email);
}
```
Example:
```php
var_dump(validateEmail('test@example.com')); // true
var_dump(validateEmail('invalid-email')); // false
``` …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 validates an email address using a regex and returns a boolean.
Of course. Here is a PHP function that validates an email address using a regular expression.
While a regex is a common approach, it's important to note that **PHP's built-in `filter_var()` function is the recommended and more robust method**. I will provide both solutions, explaining the pros and cons of each.
### 1. The Regex-Based Solution (As Requested)
This function uses `preg_match()` to test the email string against a commonly used regex pattern for email validation.
```php
/**
* Validates an email address using a regular expression.
*
* @param string $email The email address to validate.
* @return bool True if the email is valid, false otherwise.
*/
function isValidEmailWithRegex(string $email): bool
{
// A commonly used regex for email validation.
// This pattern
… Write a PHP function that validates an email address using a regex and returns a boolean.
Of course! Here is a PHP function that validates an email address using a regular expression, along with explanations and a recommendation for the best approach.
### 1. The Regex-Based Function
This function uses `preg_match()` to test the email string against a commonly used and practical regular expression.
```php
<?php
/**
* Validates an email address using a regular expression.
*
* @param string $email The email address to validate.
* @return bool True if the email is valid, false otherwise.
*/
function isValidEmailRegex(string $email): bool
{
// A commonly used and practical regex for email validation.
$pattern = '/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/';
// Use preg_match to check if the email matches the pattern.
// The function returns 1 for a m
… Write a PHP function that validates an email address using a regex and returns a boolean.
Of course! Here is a PHP function that validates an email address using a regular expression, along with explanations and a recommendation for the best approach.
### 1. The Regex-Based Function
This function uses `preg_match()` to test the email string against a commonly used and practical regular expression.
```php
<?php
/**
* Validates an email address using a regular expression.
*
* @param string $email The email address to validate.
* @return bool True if the email is valid, false otherwise.
*/
function isValidEmailRegex(string $email): bool
{
// A commonly used and practical regex for email validation.
$pattern = '/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/';
// Use preg_match to check if the email matches the pattern.
// The function returns 1 for a m
… …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 $3.74.
Each output got fed through a fight-specific regex classifier.
For tabs-vs-spaces-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 →