"; the "->" symbol is an inserted dereference operator, which is used to call member attributes and methods of an object. It is a method of calling subroutines that pass parameters by reference. The syntax is "class name->method"."/> "; the "->" symbol is an inserted dereference operator, which is used to call member attributes and methods of an object. It is a method of calling subroutines that pass parameters by reference. The syntax is "class name->method".">
search
HomeBackend DevelopmentPHP ProblemWhat is the symbol for calling class methods in php

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".

What is the symbol for calling class methods in php

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 &#39;tool.php&#39;;
  $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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools