Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Casting esplicito in PHP
<?php
$var1 = 10;
$var2 = 6.5;
var_dump($var1 + $var2); // Output: float(16.5)
$var2 = (int) 6.5;
var_dump($var1 + $var2); // Output: int(16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.