diff options
| author | Kamil Kaminski <kylek389@gmail.com> | 2015-03-07 04:24:40 -0600 | 
|---|---|---|
| committer | Kamil Kaminski <kylek389@gmail.com> | 2015-03-07 04:24:40 -0600 | 
| commit | c3c79cfe16ac522b44004668bb37411273b2cb0f (patch) | |
| tree | ca901b22991e784a9f513957737cbde1c78e54dd | |
| parent | 78c1bab624440aa6a0576c82696f08c99001fd70 (diff) | |
| download | phpsandbox-c3c79cfe16ac522b44004668bb37411273b2cb0f.tar.gz phpsandbox-c3c79cfe16ac522b44004668bb37411273b2cb0f.tar.bz2 phpsandbox-c3c79cfe16ac522b44004668bb37411273b2cb0f.zip  | |
| -rw-r--r-- | write-to-file-using-ob.php | 17 | 
1 files changed, 17 insertions, 0 deletions
diff --git a/write-to-file-using-ob.php b/write-to-file-using-ob.php new file mode 100644 index 0000000..89a3553 --- /dev/null +++ b/write-to-file-using-ob.php @@ -0,0 +1,17 @@ +<?php + +ob_start(); + +echo '<?php'; // this will go into our file +// stop php from interpreting, now write content of file freely! +?>  +echo 'hello, world!'; + +<?php +echo '?>'; // this will go into our file + +$content = ob_get_flush(); +file_put_contents('foo.txt', $content); + +?> +  | 
