Join David Powers for an in-depth discussion in this video Goodbye, part of PHP: Strict Data Types.
- [Voiceover] That concludes this brief overview…of Strict Data Types in PHP.…I hope you found it useful.…The way scaler type declarations…have been implemented in PHP seven…represents a fundamental change…that you need to be aware of…even if you never plan to use strict typing…in your own projects.…All that remains is for me, David Powers,…to thank you for watching.…I hope you'll join me again soon…in the lynda.com online training library.…
First, he introduces the basics of type juggling and type casting in PHP. Then, he reviews strict typing with objects, arrays, and callback functions, which were introduced in PHP 5. He also reviews scalar type hints in PHP 7, which can have unexpected side effects for unwary developers. David concludes with a frank assessment of the practicalities of strict typing, and a simple recommendation that will help most developers use the new feature: define in strict and execute in weak.
- Implicit and explicit type casting
- Using strict data types
- Declaring return types in PHP 7
- Creating scalar parameter declarations and scalar return type declarations
- Assessing the merits of strict data types