👩💻 Join our community of thousands of amazing developers!
Sometimes, it’s convenient when you could get to access class objects as arrays. For instance, the time when one of the class properties is of type array and you want to manipulate it just like you’d do with an array without exposing it during object creation. I’ve included a real world example of where this could be useful, at the end of the article. So, read on! In PHP, there is a predefined interface called ArrayAccess comes in PHP 5, 7 which is used to accomplish such kind of a use case. Whe...