What does -> mean/refer to in PHP?
In the following from WordPress, I know what the if statement does, for example, but what does the -> do?
max_num_pages > 1 ) : ?>
Answer
-> accesses a member of an object. So $wp_query->max_num_pages is accessing the field max_num_pages in the object $wp_query. It can be used to access either a method or a field belonging to an object, and if you're familiar with C++ or Java, it's equivalent to myObject.myField
No comments:
Post a Comment