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; } ?>
|
|---|
Sentence structure - ZinsstructuurIntroductionMany Dutch sentences have the basic word order of subject – verb – rest, as shown in the examples. The subject in each sentence is underlined, and the verbs are in red.
Word order in Dutch sentences does not always follow this pattern. The sentence structure of questions (interrogatives) and orders (imperatives) is different from that of declarative sentences. This section deals with the sentence structure of declarative sentences only. Here are three further points by way of introduction: time / manner / place There is one simple rule that can easily be remembered: if a sentence contains expressions of time and/or manner and/or place, the preferred word order is time – manner – place:
For the discussion of sentence structure, it is important to remember the term finite verb. The finite verb is the conjugated form of the infinitive. A finite verb matches the subject of the sentence in person and number.main clause / subordinate clause An important concept in the discussion of sentence structure is that of main clauses and subordinate clauses. Top of pageSentence structure in main clauses: clauses with one finite verbIn many Dutch sentences the subject precedes the finite verb, as in the sentences:
However, it is very common not to find the subject before the finite verb, but another element. This phenomenon is called inversion. In the following examples, the subject in each sentence is underlined and the verbs are in red:
Note that in these sentences the subject (ik in all three sentences) follows the verb. Another element (in Rotterdam, in het studentenhuis, volgende week) comes before the verb, in the first position of the sentence. In other words: the subject does not have to be in the first position of the sentence. If it is not (i.e. in inversion), it must follow the finite verb. So the most important rules of sentence structure in declarative main clauses, are: - The finite verb occurs in second position- If the subject is not in first position, it follows the verb and comes third. In other words: The first position of a sentence is very important: if an element from the sentence needs to be highlighted, it is usually put in that position. If this element is not the subject, the subject occurs in the third position (after the finite verb) of the sentence. We can analyse the earlier examples in this way:
Sentence structure in main clauses: clauses with other verbal elementsIt is possible for a sentence to have more verbal elements. Here, the same basic structure (finite verb comes second) can be identified.
If a sentence contains a finite verb and an infinitive, the infinitive (red and bold in the examples) appears towards the end of the sentence:
The same thing happens with separable prefixes (separable prefixes in red and bold):
This pattern also applies to sentences with a past participle (red and bold in the examples):
It now becomes important to define the ‘rest' place in the structure of the sentence:
The penultimate position in the sentence is reserved for any non-finite verbal elements such as infinitives, separable prefixes and past participles. The final position does not have to be filled, but something CAN always be put in that place. (Note that it is also possible to have 4th or 5th positions, but these do not have to be filled either.) Top of page Sentence structure in main clauses: clauses with more than one infinitiveIf a main clause contains more than one infinitive, these infinitives occur together towards the end of the main clause, i.e. in the penultimate position. If that happens, one of these infinitives is usually a modal verb. In these cases, the word order of the infinitives is specified:
In a main clause with more than one infinitive, the modal infinitive (in the example below in red) comes before the non-modal infinitive.
Top of page Sentence structure in subordinate clauses: clauses with one finite verbIn main clauses, the finite verb always comes in second position. This is not the case with subordinate clauses. The finite verb in a subclause can be found in the last or penultimate place. That is also where any other verbs will be found.
A subordinate clause cannot appear on its own; it always has to be linked to a main clause. This usually happens by means of a subordinating conjunction (or a relative pronoun in the case of relative clauses). The word dat also introduces a subordinate clause. In the examples below the finite verbs are in red:
You can see that in the main clauses in this example the finite verb (ga) comes in second place. However, in the subordinate clause, the finite verb occurs in the penultimate place (heb). As in main clauses, the final position is not always filled. However, it is always possible to fill the position:
Top of page Sentence structure in subordinate clauses: clauses with other verbal elementsIf a subordinate clause contains a finite verb and an infinitive, the infinitive (red and bold in the example) will also occur in the penultimate position:
The same thing happens with separable prefixes (separable prefix in red and bold): they are 'returned' to the finite verb.
This pattern also applies to sentences with a past participle (red and bold in the examples):
If a subordinate clause contains two verbs, the order in which these appear is quite arbitrary. Both options in the examples below are equally acceptable.
Top of page Sentence structure in subordinate clauses: clauses with more than one infinitiveIf a subordinate clause contains two verbs, the order in which these appear is quite arbitrary. However, if a subordinate clause contains more than one infinitive, the word order is specified: In a subordinate clause with more than one infinitive, the finite verb (underlined in the example below) comes first, followed by the modal infinitive (red in the example), followed in turn by the non-modal infinitive.
Top of page |