In this tutorial, you shall learn about Type Conversions in PHP, and how to convert a value of a type to another type, with the help of example programs.

PHP Type Conversions

In most of the cases, we can either use type casting or a built-in function to convert given value into required to data type.

The following PHP tutorials cover conversion of a give value to other datatypes.

String to other datatypes

Integer to other datatypes

Float to other datatypes

  • PHP – Convert float to string PHP Tutorial to convert given string into integer, if the value inside string is a valid integer.
  • PHP – Convert float to int PHP Tutorial to convert given string into floating point number, if the value inside string is a valid float.
  • PHP – Convert float to boolean

Boolean to other datatypes

  • PHP – Convert boolean to string PHP Tutorial to convert given string into integer, if the value inside string is a valid integer.
  • PHP – Convert boolean to int
  • PHP – Convert boolean to float PHP Tutorial to convert given string into floating point number, if the value inside string is a valid float.