i_like_pi
i_like_pi

Reputation: 43

php what is the "database" keyword in a function definition

What does the "database" keyword indicate in the function def below? I can't (easily) find documentation for this.

function __construct($arg1, $arg2, database $mysqli = NULL)

Upvotes: 2

Views: 40

Answers (1)

Luis Milanese
Luis Milanese

Reputation: 1286

This is type hinting. It means that the variable, in this case $mysqli, should meet at least one of the following criteria:

  1. an instance of database class;
  2. an instance from a classe that inherits from a classe named Database;
  3. an instance from a classe that implements an interface named Database.

Upvotes: 3

Related Questions