Display Ads On This Blog

Banner Ads on scriptforphp.blogspot.com
Provides free php script for php developer.
Prix: € 5.00

Monday, January 18, 2010

how to use ob_start function in php

Contact Us

Hire PHP Web Developer

Syntax :
bool ob_start ([ callback $output_callback [, int $chunk_size [, bool $erase ]]] )

what it does :
This function will turn output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer.

Example :

<?php
function callback_function($buffer)
{
// replace all the apples with oranges
return (str_replace("hi", "hello", $buffer));
}

ob_start("callback_function");
?>
<html>
<body>
<p>Hello World, example : hi to all </p>
</body>
</html>
ob_end_flush();

Output :
Hello World, example : hello to all

0 comments:

Post a Comment