Exemplo n.º 1
0
 function stream_open($path, $mode, $options, &$opened_path)
 {
     $this->_currentstring = StringStreamController::getRef(str_replace('string://', '', $path));
     if ($this->_currentstring) {
         $this->_len = strlen($this->_currentstring);
         $this->_pos = 0;
         return true;
     } else {
         return false;
     }
 }
/**
 * Test for the String Stream Controller
 * 
 * 
 * PHP/5
 *  
 * Created on Aug 7, 2008
 * 
 * @package stringstream
 * @author Sam Moffatt <*****@*****.**>
 * @author Toowoomba Regional Council Information Management Branch
 * @license GNU/GPL http://www.gnu.org/licenses/gpl.html
 * @copyright 2008 Toowoomba Regional Council/Sam Moffatt 
 * @version SVN: $Id:$    
 */
include 'stringstream.php';
echo "<pre>";
$mystring = "Joe is good";
$ref = '';
echo "My String: {$mystring}\n";
echo "Ref: {$ref}\n";
echo "\n\n";
StringStreamController::createRef('mystring', $mystring);
$ref =& StringStreamController::getRef('mystring');
echo "My String: {$mystring}\n";
echo "Ref: {$ref}\n";
echo "\n\n";
$mystring = "Pie";
echo "My String: {$mystring}\n";
echo "Ref: {$ref}\n";
echo "\n\n";