In PHP, the symbol for calling class methods is "->"; the "->" symbol is an inserted dereference operator, which is used to call member properties and methods of an object. It is called by a reference. The method of the subroutine that passes parameters, the syntax is "class name->method".
The operating environment of this tutorial: windows10 system, PHP7.1 version, DELL G3 computer
What are the symbols for calling class methods in php
'- >' symbol is the "infix dereference operator". In other words, it is a method that calls a subroutine whose parameters are passed 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(); # The output
example is as follows:
First, in a tool Declare a class in the .php file:
<?php class tool { function say(){ $result="Hello,World"; return $result; } }
Call the method in the above class in another file main.php:
<?php require_once 'tool.php'; $tool=new tool(); $content=$tool->say(); echo $content; ?>
Recommended learning: "PHP Video Tutorial 》
The above is the detailed content of What is the symbol for calling class methods in php. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6
Visual web development tools

Dreamweaver Mac version
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools
