Running PHP in Zerethon IDE
How Run starts your script with the PHP 8.4 CLI, how errors are shown, the time limit, input and tests.
Runs in Zerethon IDE · PHP 8.4
Official PHP documentation ↗
- Run (Ctrl/⌘+Enter) runs the entry file —
main.phpby default — with the PHP 8.4 CLI. Make another file the entry with the ▶ button next to it in the explorer. - It runs without a
php.ini, with every error, warning and notice reported on stderr (shown in the Output tab). Only the extensions built into the official PHP image are available. - A run is stopped after 10 seconds. Memory is limited (
memory_limit160M), there is no network, and project files are read-only (write to/tmp). - Run tests (Ctrl/⌘+Shift+Enter) runs every
test_*.phpfile on its own. A test passes when the script exits with 0 — an uncaught exception orexit(1)fails it.
test_geometry.php
<?php
require_once __DIR__ . '/geometry.php';
function check(bool $ok, string $what): void
{
if (! $ok) {
throw new RuntimeException("failed: $what");
}
}
check(area(2, 3) === 6, '2 x 3');
echo "geometry ok\n";
geometry.php from “Several files”.