This is an old revision of the document!

Request for Comments: Parameter Type Casting Hints


Currently, PHP has no way to provide type hinting for function parameters which are not classes or arrays. This is on often requested feature that has been discussed on the internals list many many times. This RFC discusses one implementation of this feature that still attempts to remain in the spirit of PHP's dynamic type nature.


This RFC discusses a method of adding scalar type hints to PHP while attempting to embrace the dynamic nature of PHP variables. This means that passing a type that does not match the hinted type will cause a cast to happen (if possible, based on the normal type-casting rules used in other areas of the engine).



rfc/parameter_type_casting_hints.1330821601.txt.gz · Last modified: 2017/09/22 13:28 (external edit)