File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
tests /
output /
ob_start_basic_002.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:06 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
1: --TEST--
2: ob_start(): Check behaviour with various callback return values.
3: --FILE--
4: <?php
5: function return_empty_string($string) {
6: return "";
7: }
8:
9: function return_false($string) {
10: return false;
11: }
12:
13: function return_null($string) {
14: return null;
15: }
16:
17: function return_string($string) {
18: return "I stole your output.";
19: }
20:
21: function return_zero($string) {
22: return 0;
23: }
24:
25: // Use each of the above functions as an output buffering callback:
26: $functions = get_defined_functions();
27: $callbacks = $functions['user'];
28: sort($callbacks);
29: foreach ($callbacks as $callback) {
30: echo "--> Use callback '$callback':\n";
31: ob_start($callback);
32: echo 'My output.';
33: ob_end_flush();
34: echo "\n\n";
35: }
36:
37: ?>
38: ==DONE==
39: --EXPECTF--
40: --> Use callback 'return_empty_string':
41:
42:
43: --> Use callback 'return_false':
44: My output.
45:
46: --> Use callback 'return_null':
47:
48:
49: --> Use callback 'return_string':
50: I stole your output.
51:
52: --> Use callback 'return_zero':
53: 0
54:
55: ==DONE==
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>