1--TEST-- 2ob_start(): Check behaviour with various callback return values. 3--FILE-- 4<?php 5function return_empty_string($string) { 6 return ""; 7} 8 9function return_false($string) { 10 return false; 11} 12 13function return_null($string) { 14 return null; 15} 16 17function return_string($string) { 18 return "I stole your output."; 19} 20 21function 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']; 28sort($callbacks); 29foreach ($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': 44My output. 45 46--> Use callback 'return_null': 47 48 49--> Use callback 'return_string': 50I stole your output. 51 52--> Use callback 'return_zero': 530 54 55==DONE==