<?php require 'trigger.php'; function logErrorsPretty($errorCode, $errorMessage, $filename, $line, $symbols) { echo "{$errorCode}!!!!{$errorMessage} {$filename} on line {$line}\n"; print_r($symbols); } set_error_handler('logErrorsPretty'); noDouble("heyo"); noDouble("what"); noDouble("yahallo"); noDouble("ayy");
<?php function noDouble($str) { if (preg_match('/(.)\\1/', $str)) { trigger_error("Double letters in {$str}", E_USER_NOTICE); } else { echo "All is good."; } } noDouble("yahallo");