1--TEST--
2Test dirname() function : usage variations
3--SKIPIF--
4<?php
5if((substr(PHP_OS, 0, 3) != "WIN"))
6  die('skip Windows only');
7?>
8--FILE--
9<?php
10for ($i=0 ; $i<5 ; $i++) {
11    try {
12        var_dump(dirname("/foo/bar/baz", $i));
13    } catch (\ValueError $e) {
14        echo $e->getMessage() . "\n";
15    }
16}
17
18var_dump(dirname("/foo/bar/baz", PHP_INT_MAX));
19var_dump(dirname("g:/foo/bar/baz", PHP_INT_MAX));
20var_dump(dirname("g:foo/bar/baz", PHP_INT_MAX));
21?>
22--EXPECT--
23dirname(): Argument #2 ($levels) must be greater than or equal to 1
24string(8) "/foo/bar"
25string(4) "/foo"
26string(1) "\"
27string(1) "\"
28string(1) "\"
29string(3) "g:\"
30string(3) "g:."
31