1--TEST--
2Test rewinddir() function : usage variations - file pointers
3--FILE--
4<?php
5/* Prototype  : void rewinddir([resource $dir_handle])
6 * Description: Rewind dir_handle back to the start
7 * Source code: ext/standard/dir.c
8 * Alias to functions: rewind
9 */
10
11/*
12 * Pass a file pointer to rewinddir() to test behaviour
13 */
14
15echo "*** Testing rewinddir() : usage variations ***\n";
16
17echo "\n-- Open a file using fopen --\n";
18var_dump($fp = fopen(__FILE__, 'r'));
19
20$result1 = fread($fp, 5);
21var_dump(rewinddir($fp));
22$result2 = fread($fp, 5);
23
24echo "\n-- Check if rewinddir() has repositioned the file pointer --\n";
25if ($result1 === $result2) {
26	echo "rewinddir() works on file pointers\n";
27} else {
28	echo "rewinddir() does not work on file pointers\n";
29}
30?>
31===DONE===
32--EXPECTF--
33*** Testing rewinddir() : usage variations ***
34
35-- Open a file using fopen --
36resource(%d) of type (stream)
37
38Warning: rewinddir(): %d is not a valid Directory resource in %s on line %d
39bool(false)
40
41-- Check if rewinddir() has repositioned the file pointer --
42rewinddir() does not work on file pointers
43===DONE===
44