summaryrefslogtreecommitdiff
path: root/ext/standard/tests/general_functions/ob_start_closures.phpt
blob: c4b5fcc50d7d73fde377c3b6779db54a23f5470a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--TEST--
Test ob_start() function : closures as output handlers
--INI--
output_buffering=0
--FILE--
<?php
echo "*** Testing ob_start() : closures as output handlers ***\n";

ob_start(function ($output) {
  return 'Output (1): ' . $output;
});

ob_start(function ($output) {
  return 'Output (2): ' . $output;
});

echo "Test\nWith newlines\n";

$str1 = ob_get_contents ();

ob_end_flush();

$str2 = ob_get_contents ();

ob_end_flush();

echo $str1, $str2;

?>
--EXPECT--
*** Testing ob_start() : closures as output handlers ***
Output (1): Output (2): Test
With newlines
Test
With newlines
Output (2): Test
With newlines