{"id":314,"date":"2014-08-12T01:16:57","date_gmt":"2014-08-12T09:16:57","guid":{"rendered":"http:\/\/www.tech.dimprash.com\/?p=314"},"modified":"2014-08-12T01:31:05","modified_gmt":"2014-08-12T09:31:05","slug":"what-is-ob_start-in-php","status":"publish","type":"post","link":"http:\/\/www.tech.dimprash.com\/?p=314","title":{"rendered":"What is ob_start in php ?"},"content":{"rendered":"<p>The PHP output buffering will save all the server outputs ( html and php prints) to a string variable.<\/p>\n<p>So to start buffering, use ob_start(); this will keep saved any output.<br \/>\nThen you use $variable = ob_get_clean(); to stop buffering, and copy the buffer content to the variable.<\/p>\n<p>Here are few samples of the use of ob_start() and ob_get_clean()<\/p>\n<p><code> ob_start(); \/\/Turn on output buffering ?><br \/>\nHello world, <a href=\"http:\/\/www.blogger.com\/myotherpage.php\">link<\/a><br \/>\nContent<br \/>\n$var = ob_get_clean(); ?><\/code>  \/\/copy current buffer contents into $message variable and delete current output buffer <\/p>\n","protected":false},"excerpt":{"rendered":"<p>The PHP output buffering will save all the server outputs ( html and php prints) to a string variable. So to start buffering, use ob_start(); this will keep saved any output. Then you use $variable = ob_get_clean(); to stop buffering, and copy the buffer content to the variable. Here are few samples of the use &hellip; <a href=\"http:\/\/www.tech.dimprash.com\/?p=314\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">What is ob_start in php ?<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-314","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/314","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=314"}],"version-history":[{"count":5,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/314\/revisions"}],"predecessor-version":[{"id":319,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/314\/revisions\/319"}],"wp:attachment":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=314"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=314"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=314"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}