Advertisement
fruffl

Pointers?

Mar 2nd, 2012
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. $a = new tArray(["The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"]);
  2. $b = new tArraySegment($a, 2, 5); //"brown", "fox", "jumps", "over", "the"
  3.  
  4. $a[3] = 'LION';
  5.  
  6. // expected
  7. var_dump($a); // "The", "quick", "brown", "LION", "jumps", "over", "the", "lazy", "dog"
  8. var_dump($b); //"brown", "LION", "jumps", "over", "the"
  9.  
  10.  
  11. object(ILLI\System\Collection\TArraySegment)#3 (5) {
  12. ["__reference":"ILLI\System\Collection\TArraySegment":private]=>
  13. &object(ILLI\System\Collection\TArray)#2 (4) {
  14. ["__itMode":"ILLI\System\Collection\TArray":private]=>
  15. int(0)
  16. ["__index":"ILLI\System\Collection\TArray":private]=>
  17. int(0)
  18. ["__array":"ILLI\System\ProtoArray":private]=>
  19. array(9) {
  20. [0]=>
  21. string(3) "The"
  22. [1]=>
  23. string(5) "quick"
  24. [2]=>
  25. string(5) "brown"
  26. [3]=>
  27. string(4) "LION"
  28. [4]=>
  29. string(5) "jumps"
  30. [5]=>
  31. string(4) "over"
  32. [6]=>
  33. string(3) "the"
  34. [7]=>
  35. string(4) "lazy"
  36. [8]=>
  37. string(3) "dog"
  38. }
  39. ["__protMode":"ILLI\System\ProtoArray":private]=>
  40. int(0)
  41. }
  42. ["__itMode":"ILLI\System\Collection\TArray":private]=>
  43. int(0)
  44. ["__index":"ILLI\System\Collection\TArray":private]=>
  45. int(0)
  46. ["__array":"ILLI\System\ProtoArray":private]=>
  47. array(5) {
  48. [2]=>
  49. string(5) "brown"
  50. [3]=>
  51. string(3) "fox"
  52. [4]=>
  53. string(5) "jumps"
  54. [5]=>
  55. string(4) "over"
  56. [6]=>
  57. string(3) "the"
  58. }
  59. ["__protMode":"ILLI\System\ProtoArray":private]=>
  60. int(0)
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement