1--TEST--
2Test ob_get_contents() function : basic functionality
3--CREDITS--
4Iain Lewis <ilewis@php.net>
5--FILE--
6<?php
7echo "*** Testing ob_get_contents() : basic functionality ***\n";
8
9// Zero arguments
10echo "\n-- Testing ob_get_contents() function with Zero arguments --\n";
11/* Buffering not started yet, should return false */
12var_dump( ob_get_contents() );
13
14ob_start();
15echo "Hello World\n";
16$hello = ob_get_contents();
17var_dump($hello);
18ob_end_flush();
19
20
21echo "\ncheck that we don't have a reference\n";
22ob_start();
23echo "Hello World\n";
24$hello2 = ob_get_contents();
25$hello2 = "bob";
26var_dump(ob_get_contents());
27ob_end_flush();
28
29echo "\ncheck that contents disappear after a flush\n";
30ob_start();
31echo "Hello World\n";
32ob_flush();
33var_dump(ob_get_contents());
34ob_end_flush();
35
36echo "\ncheck that no contents found after an end\n";
37ob_start();
38echo "Hello World\n";
39ob_end_flush();
40var_dump(ob_get_contents());
41
42
43echo "Done\n";
44?>
45--EXPECT--
46*** Testing ob_get_contents() : basic functionality ***
47
48-- Testing ob_get_contents() function with Zero arguments --
49bool(false)
50Hello World
51string(12) "Hello World
52"
53
54check that we don't have a reference
55Hello World
56string(12) "Hello World
57"
58
59check that contents disappear after a flush
60Hello World
61string(0) ""
62
63check that no contents found after an end
64Hello World
65bool(false)
66Done
67