面向对象编程->操作员 [英] Object Oriented Programming -> Operator

查看:70
本文介绍了面向对象编程->操作员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
参考-此符号在PHP中是什么意思?

Possible Duplicate:
Reference - What does this symbol mean in PHP?

因此,我一直在阅读David Powers撰写的《 PHP解决方案,轻松实现动态Web设计》一书.我通读了有关面向对象PHP的简短文章,并且很难理解->运算符的思想.任何人都可以尝试对OOP PHP中的->运算符给出可靠的解释吗?

So I've been reading through the book PHP Solutions, Dynamic Web Design Made Easy by David Powers. I read through the short section on Object Oriented PHP, and I am having a hard time grasping the idea of the -> operator. Can anyone try to give me a solid explanation on the -> operator in OOP PHP?

示例:

$westcost = new DateTimeZone('America/Los_Angeles');
$now->setTimezone($westcoast);

还有一个更一般的示例:

Also,a more general example:

$someObject->propertyName

推荐答案

$someObject->propertyName可以理解为:

返回值,该值来自对象$ someObject

return value stored in propertyName from object $someObject

$someObject->methodName()可以读取为:

执行方法名称来自对象$ someObject

execute methodName from object $someObject

这篇关于面向对象编程->操作员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆