Since PHP is convenient tool to process text contents and data from internet, sometimes we use PHP to process a large amount of data as batch script program, and running for a long time. But we may want to change the process rules from PHP script without restarting the program manually. In this case a self modification detection is very useful. class ScriptUpdater{ private static $scripts; private static $md5; //add a script file to watch the modification, filePath can be string or array public static function addScript($filePath){ if(is_array($filePath)) return self::addScript(array_pop($filePath)) && self::addScript($filePath); return ($md5 = @md5_file($filePath)) && (self::$scripts[$filePath] = $md5); } //reutrn the modified file or false, (if modified excutes a function) public static function update($onUpdateFunc = null, $args = null){ if($onUpdateFunc) return self::_watch() && @call_user_func_array($onUpdateFunc, $args); e...