PHP code example of clayfreeman / string-stream

1. Go to this page and download the library: Download clayfreeman/string-stream library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

clayfreeman / string-stream example snippets


use ClayFreeman\StringStream\StringStream;

$stream = new StringStream('sample string');
var_export((string) $stream); // 'sample string'

// Reset the stream offset to the beginning.
var_export($stream->read(2)); // 'sa'
var_export($stream->getContents()); // 'mple string'

$stream->write('some more contents');
var_export((string) $stream); // 'sample stringsome more contents'