PHP Code Typing Test

Live CPM0
Accuracy100%
Time01:00
Start typingPHP / 60s
Type the displayed code. Pasting and drag-and-drop are disabled.Ready for PHP, 60 seconds. Start typing when you are ready.
class OrderServiceOrderService { private array $orders = []; private array $events = []; public function add(array $order): void { $id = (string)($order['id'] ?? count($this->orders) + 1); $this->orders[$id] = [ 'id' => $id, 'customer' => trim((string)($order['customer'] ?? '')), 'items' => $this->normalizeItems($order['items'] ?? []), 'status' => 'pending', 'createdAt' => time(), ]; $this->events[] = ['type' => 'created', 'orderId' => $id, 'at' => time()]; } public function approve(string $id): bool { if (!isset($this->orders[$id]) || $this->orders[$id]['status'] !== 'pending') return false; $this->orders[$id]['status'] = 'approved'; $this->events[] = ['type' => 'approved', 'orderId' => $id, 'at' => time()]; return true; } public function totals(): array { $result = ['count' => 0, 'subtotal' => 0.0, 'tax' => 0.0, 'grandTotal' => 0.0]; foreach ($this->orders as $order) { $subtotal = array_reduce($order['items'], fn(float $sum, array $item): float => $sum + $item['price'] * $item['quantity'], 0.0); $result['count']++; $result['subtotal'] += $subtotal; } $result['tax'] = round($result['subtotal'] * 0.11, 2); $result['grandTotal'] = round($result['subtotal'] + $result['tax'], 2); return $result; } private function normalizeItems(array $items): array { return array_values(array_filter(array_map(function (array $item): array { return ['name' => trim((string)($item['name'] ?? 'item')), 'price' => max(0, (float)($item['price'] ?? 0)), 'quantity' => max(1, (int)($item['quantity'] ?? 1))]; }, $items), fn(array $item): bool => $item['price'] > 0)); } }
Focus here and start typing to begin
built for developersReal code typing practice. Useful metrics. Improve faster.Learn more

Codestroke is a code typing test for developers. Practice real JavaScript, Python, SQL, Java, C++, HTML/CSS, PHP, Go, and Kotlin snippets instead of ordinary prose.

This PHP typing test focuses on type declarations, arrays, and object-oriented classes. Choose a 30, 60, or 120 second session and track your code typing speed and accuracy as you practice.

PHP code typing practice

Practice a PHP typing test with type declarations, arrays, and object-oriented classes. Build PHP typing speed while keeping variables, punctuation, and structure accurate.

Try the main code typing test or choose another language from the directory below.

01

Real snippets

Practice syntax, punctuation, and indentation developers actually use.

02

Useful metrics

Track live CPM, accuracy, time, and detailed session results.

03

Flexible practice

Choose a 30, 60, or 120 second test and improve at your pace.

how speed and accuracy work

Code typing speed is measured in CPM (characters per minute), so symbols, brackets, and indentation count just like letters. Accuracy shows how much of the snippet you entered correctly. Pick a language to practice a focused code typing test:

code typing test FAQ

What does the PHP typing test include?

The PHP test uses realistic snippets with type declarations, arrays, functions, and object-oriented classes.

What is a code typing test?

A code typing test measures how quickly and accurately you can type real source code instead of ordinary prose. Codestroke is built for developers.

How does a coding speed test work?

Code contains symbols, brackets, and short tokens, so CPM measures every typed character. Codestroke also reports WPM, accuracy, and the selected test duration.

Why measure CPM instead of WPM?

Words per minute can be misleading for code because syntax contains punctuation and short tokens. CPM gives a clearer view of code typing speed.

Which languages can I practice?

You can practice JavaScript, Python, SQL, Java, C++, HTML/CSS, PHP, Go, and Kotlin snippets.

Is Codestroke free?

Yes. The typing test is free in modern web browsers, and you can begin as a guest without creating an account.

language directory9 Language Speed Tests & Technical ExplainerExplore

PHP typing practice for typed backend code

Use PHP snippets built around services, validation, arrays, and small data-processing tasks. You can practice the mix of modern PHP type declarations and familiar associative-array syntax that appears in everyday backend code.

01typed parameters, return values, and properties

02arrays, null coalescing, and callbacks

03classes, queues, and service methods

Watch dollar signs, arrows, brackets, and return types—the symbols are short but frequent in PHP. Compare code typing scores on the leaderboard.

CPM vs WPM in CodeCode snippets contain symbols, brackets, and short tokens. CPM (Characters Per Minute) measures every keypress accurately, while WPM equals CPM divided by 5.
Real Snippets & DurationsPractice 30s, 60s, or 120s sessions with real language syntax across 9 programming languages in guest mode or with optional account sync.