How does ArrayAccess work?

I read about commonly used PHP interfaces from SPL, such as Iterator, Countableand ArrayAccess. However, I do not understand how they work.

Do their implementations affect the basic functionality of PHP, for example, overloading the array operator []?

I also read about the Operator extension, which provides the ability to overload other operators in the same way as lower-level languages. Since the Operator extension explicitly modifies the PHP core, I was wondering how it ArrayAccessworks the same way as behind the scenes?

I'm a thief, so it's hard for me to use something without knowing what's under the hood.

+5
source share
1

PHP PHP Zend Engine. Zend Engine (PHP-) , , PHP.

Zend Engine (, ArrayAccess), , (idem Iterator). , PHP ( zend). Zend ( " zend" ); zend_object, - , - zend_class_entry).

ArrayAccess SPL; Zend Engine. read_dimension/write_dimension/has_dimension zend , , , (. ).

Iterator SPL; Zend Engine. . ; Zend. zend_class_entry : iterator_funcs get_iterator. . Iterator , , , , , zend_class_entry , PHP. PHP-, ( ), , , Iterator PHP- ( PHP ) , .

Countable - , SPL; Zend Engine . , count count, .

. Zend Engine ( , , ZEND_ASSIGN_ADD , / PHP, ).

+10

All Articles