PHP OOP Type hinting Type declaration

Type hinting or type declaration allows to declare data type of argument in function definition, so that function can accept same type of data on it, otherwise it will through the fatal error.


function sum(int $x, int $y){
	echo $x+$y;
sum(10, 20);
sum ("1","2");
© 2016 - 2022, All Rights are Reserved.