- strpos: documentation ( source)
<?php
function test($f) {
try {
$f();
echo "No error?\n";
} catch (TypeError|ValueError $e) {
if (strpos($e->getMessage(), '($WRONG_SCOPE_')) {
echo "Bad error! ", $e->getMessage(), "\n";
} else {
echo "Good error.\n";
}
}
}
test(fn($WRONG_SCOPE_1 = 0, $WRONG_SCOPE_2 = 0) => gmp_init(1) < "x");
test(fn($WRONG_SCOPE_1 = 0, $WRONG_SCOPE_2 = 0) => gmp_init(1) < []);
test(fn($WRONG_SCOPE_1 = 0, $WRONG_SCOPE_2 = 0) => gmp_init(1) + "x");
test(fn($WRONG_SCOPE_1 = 0, $WRONG_SCOPE_2 = 0) => gmp_init(1) + []);