-1

What is the difference between :: and -> in php

For example

class hi{
public function bye(){
echo 'bye';
}
}

$hi = new Hi();

$hi::hi();
$hi -> hi();
Champa
  • 85
  • 7

1 Answers1

1

-> is for a method of a class instance. :: is for a static class method.

wogsland
  • 9,106
  • 19
  • 57
  • 93