Advertisement
fruffl

Untitled

Mar 2nd, 2012
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.65 KB | None | 0 0
  1.  
  2. <?PHP
  3.  
  4.  
  5.     CLASS TArraySegment implements iterator oder sowas
  6.     {
  7.         private $__reference    = NULL;
  8.         private $__length   = NULL;
  9.         private $__start    = NULL;
  10.         private $__first    = NULL;
  11.         private $__last     = NULL;
  12.        
  13.         public function __construct(TArray &$array, $start = NULL, $length = NULL)
  14.         {
  15.             $this->__reference =& $array;
  16.            
  17.             $this->__start  = $start;
  18.             $this->__length = $length;
  19.        
  20.             $this->__first = ($start === NULL)
  21.                 ? 0
  22.                 : $start;
  23.                
  24.             $this->__last = ($length === NULL)
  25.                 ? $array->peek()
  26.                 : $array->peek($start + $length - 1);
  27.         }
  28.     }
  29. ?>
  30.  
  31.  
  32. object(ILLI\System\Collection\TArraySegment)#3 (5) {
  33.   ["__reference":"ILLI\System\Collection\TArraySegment":private]=>
  34.   &object(ILLI\System\Collection\TArray)#2 (4) {
  35.     ["__itMode":"ILLI\System\Collection\TArray":private]=>
  36.     int(0)
  37.     ["__index":"ILLI\System\Collection\TArray":private]=>
  38.     int(0)
  39.     ["__array":"ILLI\System\ProtoArray":private]=>
  40.     array(9) {
  41.       [0]=>
  42.       string(3) "The"
  43.       [1]=>
  44.       string(5) "quick"
  45.       [2]=>
  46.       string(5) "brown"
  47.       [3]=>
  48.       string(4) "LION"
  49.       [4]=>
  50.       string(5) "jumps"
  51.       [5]=>
  52.       string(4) "over"
  53.       [6]=>
  54.       string(3) "the"
  55.       [7]=>
  56.       string(4) "lazy"
  57.       [8]=>
  58.       string(3) "dog"
  59.     }
  60.     ["__protMode":"ILLI\System\ProtoArray":private]=>
  61.     int(0)
  62.   }
  63.   ["__length":"ILLI\System\Collection\TArraySegment":private]=>
  64.   int(5)
  65.   ["__start":"ILLI\System\Collection\TArraySegment":private]=>
  66.   int(2)
  67.   ["__first":"ILLI\System\Collection\TArraySegment":private]=>
  68.   int(2)
  69.   ["__last":"ILLI\System\Collection\TArraySegment":private]=>
  70.   int(6)
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement