Last active
April 27, 2021 08:04
-
-
Save amnuts/756d8985756278a403221494d9c0bfc5 to your computer and use it in GitHub Desktop.
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