Home  >  Article  >  Backend Development  >  What does -> mean in php

What does -> mean in php

王林
王林Original
2020-05-18 09:37:1617109browse

What does -> mean in php

[->] symbol is the "insertive dereference operator". In other words, it is used to call methods of subroutines that pass parameters by reference (among other things, of course). As we mentioned above, when calling PHP functions, most parameters are passed by reference. The '->' functions in PHP are just like they are in Perl or C.

The following is a simple dereference example:

echo $x->def(); # 输出

[->] operator is used in the operation of classes and objects, usually the invocation of class methods. The following is an example:

<?php
class foo
{
function do_foo()
{
echo "Doing foo.";
}
}
$bar = new foo;
$bar->do_foo();
?>

For more related tutorials, please visit php中文网.

The above is the detailed content of What does -> mean in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn