define('PREG_FIND_RECURSIVE', 1); define('PREG_FIND_DIRMATCH', 2); define('PREG_FIND_FULLPATH', 4); define('PREG_FIND_NEGATE', 8); define('PREG_FIND_DIRONLY', 16); define('PREG_FIND_RETURNASSOC', 32); define('PREG_FIND_SORTDESC', 64); define('PREG_FIND_SORTKEYS', 128); define('PREG_FIND_SORTBASENAME', 256); # requires PREG_FIND_RETURNASSOC define('PREG_FIND_SORTMODIFIED', 512); # requires PREG_FIND_RETURNASSOC define('PREG_FIND_SORTFILESIZE', 1024); # requires PREG_FIND_RETURNASSOC define('PREG_FIND_SORTDISKUSAGE', 2048); # requires PREG_FIND_RETURNASSOC // PREG_FIND_RECURSIVE - go into subdirectorys looking for more files // PREG_FIND_DIRMATCH - return directorys that match the pattern also // PREG_FIND_DIRONLY - return only directorys that match the pattern (no files) // PREG_FIND_FULLPATH - search for the pattern in the full path (dir+file) // PREG_FIND_NEGATE - return files that don't match the pattern // PREG_FIND_RETURNASSOC - Instead of just returning a plain array of matches, // return an associative array with file stats // // You can also request to have the results sorted based on various criteria // By default if any sorting is done, it will be sorted in ascending order. // You can reverse this via use of: // PREG_FIND_SORTDESC - Reverse order of sort // PREG_FILE_SORTKEYS - Sort on the keyvalues or non-assoc array results // The following sorts *require* PREG_FIND_RETURNASSOC to be used as they are // sorting on values stored in the constructed associative array // PREG_FIND_SORTBASENAME - Sort the results in alphabetical order on filename // PREG_FIND_SORTMODIFIED - Sort the results in last modified timestamp order // PREG_FIND_SORTFILESIZE - Sort the results based on filesize // PREG_FILE_SORTDISKUSAGE - Sort based on the amount of disk space taken // to use more than one simply seperate them with a | character // Search for files matching $pattern in $start_dir. // if args contains PREG_FIND_RECURSIVE then do a recursive search // return value is an associative array, the key of which is the path/file // and the value is the stat of the file. Function preg_find($pattern, $start_dir='.', $args=NULL) { static $depth = -1; ++$depth; $files_matched = array(); $fh = opendir($start_dir); while (($file = readdir($fh)) !== false) { if (strcmp($file, '.')==0 || strcmp($file, '..')==0) continue; $filepath = $start_dir . '/' . $file; if (preg_match($pattern, ($args & PREG_FIND_FULLPATH) ? $filepath : $file)) { $doadd = is_file($filepath) || (is_dir($filepath) && ($args & PREG_FIND_DIRMATCH)) || (is_dir($filepath) && ($args & PREG_FIND_DIRONLY)); if ($args & PREG_FIND_DIRONLY && $doadd && !is_dir($filepath)) $doadd = false; if ($args & PREG_FIND_NEGATE) $doadd = !$doadd; if ($doadd) { if ($args & PREG_FIND_RETURNASSOC) { // return more than just the filenames $fileres = array(); if (function_exists('stat')) { $fileres['stat'] = stat($filepath); $fileres['du'] = $fileres['stat']['blocks'] * 512; } if (function_exists('fileowner')) $fileres['uid'] = fileowner($filepath); if (function_exists('filegroup')) $fileres['gid'] = filegroup($filepath); if (function_exists('filetype')) $fileres['filetype'] = filetype($filepath); if (function_exists('mime_content_type')) $fileres['mimetype'] = mime_content_type($filepath); if (function_exists('dirname')) $fileres['dirname'] = dirname($filepath); if (function_exists('basename')) $fileres['basename'] = basename($filepath); if (isset($fileres['uid']) && function_exists('posix_getpwuid')) $fileres['owner'] = posix_getpwuid ($fileres['uid']); $files_matched[$filepath] = $fileres; } else array_push($files_matched, $filepath); } } if ( is_dir($filepath) && ($args & PREG_FIND_RECURSIVE) ) { $files_matched = array_merge($files_matched, preg_find($pattern, $filepath, $args)); } } closedir($fh); // Before returning check if we need to sort the results. if (($depth==0) && ($args & (PREG_FIND_SORTKEYS|PREG_FIND_SORTBASENAME|PREG_FIND_SORTMODIFIED|PREG_FIND_SORTFILESIZE|PREG_FIND_SORTDISKUSAGE)) ) { $order = ($args & PREG_FIND_SORTDESC) ? 1 : -1; $sortby = ''; if ($args & PREG_FIND_RETURNASSOC) { if ($args & PREG_FIND_SORTMODIFIED) $sortby = "['stat']['mtime']"; if ($args & PREG_FIND_SORTBASENAME) $sortby = "['basename']"; if ($args & PREG_FIND_SORTFILESIZE) $sortby = "['stat']['size']"; if ($args & PREG_FIND_SORTDISKUSAGE) $sortby = "['du']"; } $filesort = create_function('$a,$b', "\$a1=\$a$sortby;\$b1=\$b$sortby; if (\$a1==\$b1) return 0; else return (\$a1<\$b1) ? $order : 0- $order;"); uasort($files_matched, $filesort); } --$depth; return $files_matched; } ?>
|
|---|
Past tense (imperfect) - Onvoltooid verleden tijdIntroductionThe past tense, or imperfect, is used to describe events in the past that do not have a bearing on the present, and is in that sense unlike the perfect tense which is used to describe events in the past that are still relevant. The past tense is used merely to describe events from the past.
Top of page Formation of the past tenseThe formation of the past tense is closely tied up with that of the past participle (see perfect tense). As with the perfect tense, a division can be made between the past tense of regular and irregular verbs.
Top of page Formation of the past tense: regular verbsRegular verbs can be split into two categories: weak verbs and strong verbs. Both these categories of regular verbs follow certain patterns when forming the past tense.
weak verbs The past tense of weak verbs is formed by adding a suffix to the stem of the verb. This is either the suffix -de (plural -den) or the suffix -te (plural -ten), depending on the last sound of the stem. -de(n) or -te(n) The rule that decides between -de(n) or -te(n) is the same rule that is applied to determine the ending of the past participle of the perfect tense:
So, in practice, to form the past tense of the regular verbs wonen (‘to live'), zetten (‘to put'), boeken (‘to book') and landen (‘to land'), you take the following steps:
The past tense of boeken (boekte) is formed with –te because the stem of boeken (boek) ends in –k, which is a consonant from SoFT KeTCHuP. Likewise, the past tense of wonen (woonde) is formed with –de: the stem of wonen (woon) ends in –n which is not a consonant from SoFT KeTCHuP. You have to comply with the rules for spelling when forming the past participle. It is very important to determine what the stem is. For example:
It must be stressed that it is the final letter of the stem before spelling rules are applied that is important when determining the ending of the past tense. Take for example the verb reizen (‘to travel'). It may look as if the stem would be reis (taking into account the spelling rules for changing a into an at the end of a word), and following the rule given above you would expect the past tense reiste. However, it is the <z> of the infinitive that matters here. Therefore:
The same applies to weak verbs where the stem before spelling rules are applied ends in a
strong verbs Strong verbs also have a kind of regularity. They form their past tense (and their past participle) by, amongst others, changing the vowel in the stem of the verb. When examining the infinitive and the past and perfect tenses together, it is clear that these vowel mutations are a defining character of strong verbs:
Note that to arrive at the plural form of the past tense, the spelling rules have to be taken into account. In the groups of verbs that behave like eten and lezen, the singular of the past tense has a short vowel and the plural a long vowel. Some other commonly used strong verbs are:
For a basic list of irregular and strong verbs, please refer to the glossary. Top of page Formation of the past tense: irregular verbsThe tenses of the most frequently occurring irregular verbs will have to be learnt by heart. As with the strong verbs, it is useful to see the infinitive and past and perfect tenses together.
Most auxiliary verbs are irregular:
Some other commonly used irregular verbs are:
For a basic list of irregular and strong verbs, please refer to the glossary. Top of page Formation of the past tense: mixed verbsThere are a few verbs that appear to be a mixture of weak and strong. They may have a weak past tense, but a strong past participle, e.g.:
There are even a few verbs that are a mixture of regular and irregular, e.g.:
which have a regular weak past participle, but an irregular past tense. For a basic list of irregular and strong verbs, please refer to the glossary. Top of page UseThe following excerpt from Hanna's lettter to her brother Frank is an example of this:
The first and last sentences of the above piece use the perfect tense (to introduce and conclude), and the description of events in the zoo is in the past tense. The above example illustrates how the past tense is used to describe past events. The past tense is also often used to talk about habits of the past (note that the first and last line are not in the past tense!):
Top of page |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||