Tuesday, July 28, 2009

make fun with streams

Streams help us to read and write file systems. PHP provide us some functions. I am giving some short description for some stream functions. These are important for zend php certification exam.

1.stream_wrapper_register(string protocol,string classname[,int flags]): This function is used to register user defined wrappers.

the protocol is the wrapper name, classname is the classname that will define the wrapper and the flag says whether it is defined by the url.

2.stream_wrapper_restore(string protocol): This function restores a previously unregistered built-in wrapper. This is new in php 5.

3.stream_wrapper_unregister(string protocol): This function unregister a wrapper. This is new in php 5.

4.stream_context_create([array options[,array params]]): creates a context with options and params.

5.stream_context_set_option(resource context,array options): set options.

6.steam_context_set_params(resource context,array options): set params.

7.stream_context_set_default(array options): set options for default context.This is new in php 5.

8.stream_context_get_default([array options]): get the default context.This is new in php 5.

9.stream_copy_to_stream(resource source,resource dest[,int maxlength=-1[,int offset=0]]):copies stream .This is new in php 5.

10.stream_filter_register(string filtername,string classname): register a user defined filter. the class has onCreate(),onClose,filter functions.

11.stream_filter_prepend/append(resource stream,string filter[,int read_write[,mixed params]]): prepend a filter. The read_write parameter could be STREAM_FILTER_READ,STREAM_FILTER_WRITE,STREAM_FILTER_BOTH.The params will be prepended at the beginning of the stream.

12.stream_get_filters(): get list of filters. This is new in php 5.

13.stream_get_wrappers(): get list of wrappers. This is new in php 5.

14.stream_get_transports(): get list of transports. This is new in php 5.

15.stream_get_meta_data(resource stream): returns information of the current stream. It contains whether the stream is blocked, time out , how much is left for reading,seekable, stream mode, wrapper data type,filter, end of file. This function does not work on sockets.

16.stream_get_line(resource handle,int length[,string end]): gets line from the given handle upto a string end without the end string. This is new in php 5.

17.stream_filter_remove(resource stream_filter):removes the filter added before. This is new in php 5.

18.stream_get_contents(resource handle[,int maxlength[,int offset]]): gets the remaining contents of the stream. This function works on a open file stream.This is new in php 5.

19.stream_is_local(resource handle): checks whether it is local or a url.This is new in php 5.

20.stream_notification_callback(): a callback function for notification context parameter.This is new in php 5.

21.stream_select(array &read,array &write,array & except,int tv_sec[,int tv_usec=0]): This function accepts an arrays of streams and waits for status. It returns the streams that are available within the time out seconds.

22.stream_set_blocking(resource stream,int mode): sets blocking/non-blocking mode.

23.stream_set_timeout(resource stream,int sec[,int usec=0]):set timeout period,expressed in the sum of sec and usec.




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

No comments: