Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function test_with_file_exists_no_file() {
- $fileName = uniqid('');
- if (file_exists($fileName)) {
- require_once($fileName);
- }
- }
- function test_with_file_exists_with_file($fileName) {
- if (file_exists($fileName)) {
- require_once($fileName);
- }
- }
- function test_without_file_exists_no_file() {
- $fileName = uniqid('');
- @include_once($fileName);
- }
- function test_without_file_exists_with_file($fileName) {
- @include_once($fileName);
- }
- function run_test_with_file() {
- for ($i = 0; $i < 10000; $i++) {
- $fileName = uniqid('test_');
- touch($fileName);
- test_with_file_exists_with_file($fileName);
- unlink($fileName);
- }
- for ($i = 0; $i < 10000; $i++) {
- $fileName = uniqid('test_');
- touch($fileName);
- test_without_file_exists_with_file($fileName);
- unlink($fileName);
- }
- }
- run_test_with_file();
- for ($i = 0; $i < 10000; $i++) {
- test_without_file_exists_no_file();
- test_with_file_exists_no_file();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement