Tool to find lines eliminated by OpCache's bytecode optimizer

0.1.0 2018-12-24 07:17 UTC


foal finds lines of code that are eliminated by OpCache's bytecode optimizer.


PHP Archive (PHAR)

The easiest way to obtain foalis to download a PHP Archive (PHAR) that has all required dependencies bundled in a single file:

$ wget


You can add this tool as a local, per-project, development-time dependency to your project using Composer:

$ composer require --dev sebastian/foal

You can then invoke it using the ./vendor/bin/foal executable.



function f()
    $result = 'result';

    return $result;
$ php foal.phar example.php
foal 0.1.0 by Sebastian Bergmann.

The OpCache optimizer eliminated the following sourcecode lines:

4          $result = 'result';
7      }