Introduction

Introduction -- Introduction to Stream_Var

Introduction to Stream_Var

Stream_Var supplies a class that can be used as a wrapper for PHP'' stream functions. This allows you to access variables with fopen(), fclose(), fwrite(), fread(), opendir() and all other filesystem functions.

You may use stream_wrapper_register() to register Stream_Var as a wrapper.

Scalar variables (strings, integers, floats) are treated as files, while arrays represent directories.

Please see the PHP Manual or the example for more information on how to register streams.

Usage scenario

Stream_Var could be used in various scenarios. Imagine you are using a class that reads data from a file but you are creating the data on-the-fly and do not want to save the data before it can be processed by the class.

This is, where Stream_Var can be used. Just register it as a wrapper for fopen() and pass var://GLOBAL/yourVar as a parameter to the class.

It will read from the variable as if it was a file.


HIVE: All information for read only. Please respect copyright!
Hosted by hive ÊÃÁ: Êèåâñêàÿ ãîðîäñêàÿ áèáëèîòåêà