1--TEST--
2Test fscanf() function: usage variations - return type without third argument
3--FILE--
4<?php
5
6/* test fscanf() for its return type */
7
8$file_path = __DIR__;
9
10echo "*** Testing fscanf(): for its return type without third argument ***\n";
11
12// create a file
13$filename = "$file_path/fscanf_variation1.tmp";
14$file_handle = fopen($filename, "w");
15if($file_handle == false)
16  exit("Error:failed to open file $filename");
17@fwrite($file_handle, "hello_world ");
18@fwrite($file_handle, 12345);
19fclose($file_handle);
20
21// open file for reading
22$file_handle = fopen($filename, "r");
23// capturing the return value from fscanf() called without third argument
24$return_value = fscanf($file_handle, "%s");
25var_dump( is_array($return_value), $return_value); // return type is an array
26fclose($file_handle);
27
28echo "\n*** Done ***";
29?>
30--CLEAN--
31<?php
32$file_path = __DIR__;
33$filename = "$file_path/fscanf_variation1.tmp";
34unlink($filename);
35?>
36--EXPECT--
37*** Testing fscanf(): for its return type without third argument ***
38bool(true)
39array(1) {
40  [0]=>
41  string(11) "hello_world"
42}
43
44*** Done ***
45