Fake pre-warm op-cache files for testing https://github.com/amnuts/opcache-gui
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$nums = range(0, 5000); | |
foreach ($nums as $i) { | |
$path = __DIR__."/files/c{$i}.php"; | |
if (file_exists($path)) { | |
break; | |
} | |
file_put_contents($path, "<?php\n\nfunction c{$i}() { return {$i}; }\n\n"); | |
} | |
foreach (range(0, 100) as $r) { | |
$rand = array_rand($nums, 100); | |
foreach ($rand as $i) { | |
$func = "c{$i}"; | |
if (!function_exists($func)) { | |
require __DIR__ . "/files/c{$i}.php"; | |
} | |
echo $func(); | |
} | |
echo "\n"; | |
} | |
echo 'Done'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment