Mollien dot Net is IPv6 Enabled!

   My About.Me page
   View my profile on LinkedIn
   Follow me on Twitter
    View my Facebook profile   View my Hyves profile   View my YouTube favorites and uploads


IPv6 Certification Badge for Cas Mollien

File Manipulation
Parse a file to a variable
In some cases, including or requiring a file in PHP may to have the right results. Especially when including a non-PHP script, the output of the include will be printed to screen immediately, giving unexpected results.

Eventhough it is not directly possible to read a file into a variable for later use, it IS possible to redirect the output buffer to memory rather then screen, after which you can capture the memory-buffer and pass this to a variable.

You do this by using the following script:

The variable $buf now contains the contents of the file and can be used later.
Found this script/snippet useful? Please consider buying me a beer - or something else useful..

Terug naar Mollien Dot Net

Terug naar Mollien Dot Net

Terug naar Mollien Dot Net
Total Hits: 1
Unique Visitors: 1
Page Impressions : 1
Remote address: