So I was asked as part of my homework to cast a floating point number to integer in PHP. Problem is that no such cast is possible according to php.net and I myself cannot find the notion behind the question.
Given the following:
$float = 1.92;
$float += 2;
It'll just substitute them resulting in 3.92 as an output.
As far as I could see the possible (or rather allowed) casts are as follows:
The casts allowed are:
(int), (integer) - cast to integer
(bool), (boolean) - cast to boolean
(float), (double), (real) - cast to float
(string) - cast to string
(array) - cast to array
(object) - cast to object
(unset) - cast to NULL (PHP 5)
Is it some sort of trick that they have presented us with or the task is invalid?