0

I am going through the example

     $conn = new mysqli($servername, $username, $password);
        if ($conn->connect_error) {
         die("Connection failed: " . $conn->connect_error);
       }

      $sql = "CREATE DATABASE myDB";
         if ($conn->query($sql) === TRUE) {
          echo "Database created successfully";
         } else {
          echo "Error creating database: " . $conn->error;
        }

What is the meaning of the symbol -> in the above example

Sachin Bahukhandi
  • 2,378
  • 20
  • 29
john
  • 71
  • 2
  • 8

2 Answers2

1

PHP has two object operators.

The first, -> , is used when you want to call a method on an instance or access an instance property.

The second, ::, is used when you want to call a static method, access a static variable, or call a parent class's version of a method within a child class.

source: Where do we use the object operator "->" in PHP?

Community
  • 1
  • 1
Sachin Bahukhandi
  • 2,378
  • 20
  • 29
0

In PHP, -> operator is used for call member function or member variable.

Hiren Makwana
  • 1,976
  • 2
  • 13
  • 28