Advertisement
fruffl

Untitled

Mar 2nd, 2012
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1.     CLASS TArraySegment EXTENDS TArray
  2.     {
  3.         private $__reference = NULL;
  4.        
  5.         public function __construct(TArray &$array, $start = NULL, $length = NULL)
  6.         {
  7.             $this->__reference =& $array;
  8.        
  9.             $f = ($start === NULL)
  10.                 ? 0
  11.                 : $start;
  12.                
  13.             $l = ($length === NULL)
  14.                 ? $array->peek()
  15.                 : $array->peek($start + $length - 1);
  16.                
  17.            
  18.             $rawdata = $array->toArray();
  19.            
  20.             $tmp = [];
  21.            
  22.             foreach($rawdata as $key => $value)
  23.                 if($key >= $f && $key <= $l)
  24.                 {
  25.                     $$key = $this->__reference->offsetGet($key);
  26.                     $tmp[$key] =& $this->__reference->offsetGet($key);
  27.                 }
  28.            
  29.             var_dump($tmp);
  30.             parent::__construct($tmp);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement