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, 4 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

--TEST--
ob_start(): Check behaviour with various callback return values.
--FILE--
<?php
function return_empty_string($string) {
	return "";
}

function return_false($string) {
	return false;
}

function return_null($string) {
	return null;
}

function return_string($string) {
	return "I stole your output.";
}

function return_zero($string) {
	return 0;
}

// Use each of the above functions as an output buffering callback:
$functions = get_defined_functions();
$callbacks = $functions['user'];
sort($callbacks);
foreach ($callbacks as $callback) {
  echo "--> Use callback '$callback':\n";
  ob_start($callback);
  echo 'My output.';
  ob_end_flush();
  echo "\n\n";
}

?>
==DONE==
--EXPECTF--
--> Use callback 'return_empty_string':


--> Use callback 'return_false':
My output.

--> Use callback 'return_null':


--> Use callback 'return_string':
I stole your output.

--> Use callback 'return_zero':
0

==DONE==

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>