Creating a PHP function in PHP 8

How to create a function / method in PHP with type hinting and return types.

 

function is_greater_than(int $x, int $y) : bool { 

  return ($x > $y) ? true : false;

}

is_greater_than(1,2);
  

Categorized in: