php Change Data Types

If you assign an integer value to a variable, the type will automatically be an integer. If you assign a string to the same variable, the type will change to a string:

int(5) string(5) "Hello"

If you want to change the data type of an existing variable, but not by changing the value, you can use casting. Casting allows you to change data type on variables:

string(3) "575"