-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
  • 7,351
  • 16
  • 46
  • 79