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




Contact US

Email:[email protected]

OOPs Type Hinting
10/30