Skip to main content
Home / Code Snippets / PHP / Output Buffering

Output Buffering

  // Start buffering

  // Output stuff (probably not this simple, might be custom CMS functions...
  echo 'Print to the screen!!!';

  // Get value of buffering so far
  $getContent = ob_get_contents();

  // Stop buffering

  // Do stuff to $getContent as needed

  // Use it
  echo 'Now: ' . $getContent;

icon-link icon-logo-star icon-search icon-star