Javatpoint Logo
Javatpoint Logo

Type Hinting

  • In simple word, type hinting means providing hints to function to only accept the given data type.
  • In technical word we can say that Type Hinting is method by which we can force function to accept the desired data type.
  • In PHP, we can use type hinting for Object, Array and callable data type.

Example 1

Output:

Type Hinting

Example 2

Output:

Type Hinting
Next Topic




Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA