The What
What is type casting? With type casting, you are declaring the data type you want for a value by prefixing it with the data type:
(int)
or(integer)
- Casts the value to integer
(bool)
or(boolean)
- Casts the value to boolean
(string)
- Casts the value to string
(float)
,(double)
, or(real)
- Casts the value to float
(array)
- Casts the value to array
(object)
- Casts the value to object
(unset)
- Casts the value to NULL (PHP 5)
Watch the video(s) to learn more.