ToolXkit Icon

Sample PHP files

Free PHP test files from 5 KB to 1 GB. Pick a size and download, or type any size you need.

  • 5 KB PHP

    53 functions

  • 10 KB PHP

    109 functions

  • 100 KB PHP

    1,099 functions

  • 500 KB PHP

    5,413 functions

  • 1 MB PHP

    10,791 functions

  • 5 MB PHP

    Made on your device

  • 10 MB PHP

    Made on your device

  • 25 MB PHP

    Made on your device

  • 50 MB PHP

    Made on your device · saved in pieces

  • 100 MB PHP

    Made on your device · saved in pieces

  • 500 MB PHP

    Made on your device · saved in pieces

  • 1 GB PHP

    Made on your device · saved in pieces

Need another size?

Type any size from 5 KB to 1.00 GB. The file is made on your device. Nothing is uploaded or stored.

Free for any use, including commercial. Made by this site, with no third-party content and no signup.

What is inside

  • An opening <?php tag, declare(strict_types=1) and a Samples namespace
  • One final class, Employee, with a constructor that uses readonly promoted properties (PHP 8.1 or later)
  • Numbered functions, employee1() upward, each returning one employee: 109 in the 10 KB file, 260,773 in the 25 MB file
  • Names with accents and apostrophes, such as Müller and O'Brien, inside double-quoted strings
  • Every size is exact to the byte; the last line is a // comment that fills the gap
  • Running it defines the class and functions and prints nothing, so it is safe to execute

Try it with these tools

They run in your browser. The file you downloaded stays on your device.

About PHP files

PHP is a server-side language that runs a large part of the web, including WordPress and many shared-hosting sites. A .php file is plain text: it starts with an <?php tag, and the PHP interpreter reads it from top to bottom when a page is requested.

Most people meet a PHP file in an editor, a code viewer, a diff or an upload form, not only on a server. That is where a big file is useful: it shows whether a syntax highlighter slows down, whether a formatter gives up, or whether an upload limit is lower than you thought.

The usual trouble with PHP files is the version. Newer syntax, such as readonly properties or typed parameters, is a parse error on an older interpreter, so a file that runs on your laptop can fail on a server that has not been upgraded. Check the PHP version on both ends before blaming the code.

Sources: PHP manual (php.net) · PHP manual: properties and readonly properties (php.net) · PHP 8.1 release notes (php.net)

Questions

Which PHP version do I need to run these files?

PHP 8.1 or newer. The class uses readonly promoted properties, which PHP 8.0 and older reject with a parse error.

How is the 1 MB PHP file exactly 1,000,000 bytes?

Functions are added until the next one would not fit, and the few bytes left are filled with a // comment line at the end. PHP ignores comments, so the padding changes nothing when the file runs.

Can I put these files in a public repo or a paid product?

Yes. A script on this site wrote every line, there is no third-party code in them, and they are public domain (CC0).

Also searched as: sample php file download, dummy php file, test php file, example php file, 1 MB php file, 10 MB php file, 100 MB php file, 1 GB php file, free php for testing.

For developers: exact bytes and SHA-256

Sizes are decimal (1 MB = 1,000,000 bytes). The hosted files never change between builds, so these checksums stay valid.

FileBytesSHA-256
sample-5kb.php 5,000 bytes 294ef7d04efa6107f024ebfc0e2abba7b28bc04adbe2eb24d045d25287853ac9
sample-10kb.php 10,000 bytes 130d1a9f5c2f4ba4b8212a4c13a82a2f79d0bb26a65a3712bce08eedf00b1c2f
sample-100kb.php 100,000 bytes 78dbcb4acc61a76061f1e2a809727e76c4c04194760fc44d041f54f3244b94be
sample-500kb.php 500,000 bytes 6e20fe83d7529380a1b63e2259db96c430ef80024ca39778b303816b9e9fe849
sample-1mb.php 1,000,000 bytes db11a108b61e76eaa1b4c38822f2ff9893303d531dfb4e741bd7d1511700e344