PHP Type Casting

Agenda of this session

PHP Type Casting

PHP Type Casting

The term "Casting" refers to conversion of one type of data to another. Since PHP is a weakly typed language, the parser coerces certain data types into others while performing certain operations. For example, a string having digits is converted to integer if it is one of the operands involved in the addition operation.

    Casting in PHP is done with these statements:

  • (string) - Converts to data type String
  • (int) - Converts to data type Integer
  • (float) - Converts to data type Float
  • (bool) - Converts to data type Boolean
  • (array) - Converts to data type Array
  • (object) - Converts to data type Object
  • (unset) - Converts to data type NULL



We have our own LMS. SMARTLEARN is cloud based user-friendly Learning Management System. You will get 24 X 7 hours access by login with a unique username and password. The full course content has been uploaded in the LMS. Please Register with us. After registration you will get the login details.  Register Now