Location: PHPKode > scripts > Output Buffering handler > output-buffering-handler/OBH.example.php
<?php

require('OBH.class.php');

//First we create the OBH element
$OB = new OBH;

//Next we prepend the output with the string 'Hello'
//Notice regular PHP syntax
// %in% is replaced with the output given, escaped by single-quotes by default
$OB->addH("'Hello'.'%in%'");

//We then run the output through the strtoupper function
$OB->addH("strtoupper('%in%')");

//And then we tell the script to run the output through str_replace BEFORE running the previous output handlers
//As you might also notice, %in% is now escaped for double-quotes (we do this since %in% is in double quotes).
$OB->addHFirst('str_replace("cheese", "world!", "%in%")', ESCAPE_DOUBLE_QUOTES);

//This will send some output to the class
echo ' cheese';

//But the final output will be:
// HELLO WORLD!

?>
Return current item: Output Buffering handler