PracticeType hinting

Let's practice what we have just learned

* Press on the "solution button" to see our suggested solution.

Which data types can be declared with type hinting?

  • A Booleans, integers, and strings
  • B Arrays, objects, and interfaces
  • C Type hinting for arrays and objects is supported in both PHP5 and 7, while scalar type hinting (for integers, floats, strings, and booleans) is only supported in PHP7.
Solution:

Scratchpad to practice your coding *This will not be saved nor submitted to us.*

<?php
//Your practice code
comments powered by Disqus