What are the differences between Type Hinting and Type Casting in PHP?

Type hinting in PHP is used to specify the data type of a parameter in a function declaration, ensuring that the argument passed to the function is of the specified type. Type casting, on the other hand, is used to explicitly convert a value from one data type to another. Type hinting helps in enforcing strict data types, while type casting allows for more flexible data manipulation.

// Type Hinting example
function addNumbers(int $num1, int $num2) {
    return $num1 + $num2;
}

// Type Casting example
$floatNumber = 10.5;
$intNumber = (int) $floatNumber;