rookie PHP question, what does -> represent?
I am a rookie with PHP, w开发者_如何学运维hat does this do ->? i tried Google and searching the forums but nothing came up. for instance, i have seen "$resp->is_valid" used but not sure what it does. Thanks
If you have an instance of an object, then ->
accesses a property or method inside that object.
For example:
$mysqli_object = new mysqli( ... );
$mysqli_statement = $mysqli_object->prepare( ... );
// calls the prepare() method of mysqli_object
The ->
operator is similar to the ::
operator in that both access something inside a class. However, ::
is for accessing things for objects that do not need to be instantiated:
$sum = MySumClass::sum( ... );
// I don't need to first create an instance (using "new") of
// MySumClass before using it because MySumClass::sum() is static
In PHP ->
is used to access a property (or method) of an object. You can read more here:
http://php.net/manual/en/sdo.sample.getset.php
It returns the member variable $is_valid
of the object referred to by $resp
精彩评论