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--EXPECT-- 39--> Use callback 'return_empty_string': 40 41 42--> Use callback 'return_false': 43My output. 44 45--> Use callback 'return_null': 46 47 48--> Use callback 'return_string': 49I stole your output. 50 51--> Use callback 'return_zero': 520 53 54