Difference between ArrayIterator, ArrayObject and Array in PHP

后端 未结 6 1677
一整个雨季
一整个雨季 2021-02-01 16:19

Can somebody explain clearly the fundamental differences between ArrayIterator, ArrayObject and Array in PHP in terms of functionality and

6条回答
  •  不知归路
    2021-02-01 16:47

    array is one the eight primitive types in PHP. Allthough it comes with a lot of built-in utility functions, but they are all procedural.

    Both the ArrayObject and the ArrayIterator allow us to make arrays first class citizens in an object oriented program (OOP).

    Difference between ArrayObject and the ArrayIterator is that, since ArrayIterator implements SeekableIterator interface, you can do $myArray->seek(10); with ArrayIterator.

提交回复
热议问题