//type conversion: php performs automatic variable casting. make sure you get what happens behind the scenes.
$variable_g = "1"; // the result is an integer
$variable_h = "1.0"; // the result is a float
$combined_variable = $variable_g + $variable_h; // this combines the two into a new version
var_dump($combined_variable);
the output is: "float(2)", the variable was cast into a float
// then connecting two variables, in this case an integer with a float using the "." connector the result is a string
$variable_i = "1"; // the result is an integer
$variable_j = "1.0"; // the result is a float
$combined_variable = $variable_i.$variable_j; // this combines the two into a new version
var_dump($combined_variable);
the output is a "string(4) "11.0"
Symfony Expert a leading PHP Web development company in USA. Hire Symfony developer at affordable price.
AntwortenLöschen