Several files

Load your other files with require; Composer packages are not available.

Runs in Zerethon IDE · PHP 8.4 Official PHP documentation ↗
main.php
<?php

require_once __DIR__ . '/geometry.php';

echo area(3, 4), "\n";
geometry.php
<?php

function area(int $width, int $height): int
{
    return $width * $height;
}

Output

12
  • require stops with a fatal error when the file is missing; include only warns. _once loads a file one time.
  • There is no Composer autoloader and no vendor/: nothing is installed, and runs have no network.

Related topics

Official references