function checkStr( $sInput ) {
$sRegexp = '~^(:?%u00[0-9][0-9a-zA-Z])++$~';
return preg_match($sRegexp, $sInput);
}
assert('checkStr("%u003c%u0073%u0063%u0072%u0069%u0070%u0074%u003e")');
assert('checkStr("%u003c")');
assert('checkStr("%u0046%u005c")');
assert('checkStr("asd")==false');
assert('checkStr("%a003da")==false');
assert('checkStr("%k41ad")==false');
assert('checkStr("Бла бла бла")==false');
assert('checkStr("%u003c%u0073%u0063%")==false');
assert('checkStr("%u003c%u0073ASFQ%u0063")==false');
$rFrom = new datetime('first day of -6 month midnight');
$rTo = new datetime('last day of -6 month midnight');
var_dump($rFrom, $rTo);
class foo {
private static function minifyJS($fooo) {
echo 'called '.__METHOD__;
return '';
}
public static function test() {
$start_buffer = "<script>foooo</script>";
$start_buffer = preg_replace_callback(
'/<\s*script(?![^>]*\.js)[^>]*>(.*?)<\/script>/s',
"self::minifyJS",
$start_buffer
);
}
}
foo::test();