<?php if (class_exists('A')) { echo "1 A exists, early returning.\n"; return; } else { echo "1 A does not exist, continuing.\n"; } echo "1 Continuing evaluation…\n"; class A {} function f() {} if (class_exists('A')) { echo "2 A exists, early returning.\n"; return; } else { echo "2 A does not exist, continuing.\n"; } echo "2 Continuing evaluation…\n"; // Apparently this is fine even though we're defining the same class? class A {} // Uncomment this and it's an error: // function f() {}
You have javascript disabled. You will not be able to edit any code.