Wednesday, September 26, 2018

wordpress - What does "->" mean/refer to in PHP?




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

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...