This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$car = "Ferrari"; | |
$model = 'F40'; | |
echo "Auto $car \n"; | |
echo "Modello $model\n"; | |
/* | |
Output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$float = 123.30; | |
$float2 = 120e-3; // Sintassi con esponente | |
echo $float."\n"; | |
echo $float2; | |
/* | |
Output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dec = 40; // decimale | |
$oct = 0321; // ottale | |
$hex = 0xBC; // esadecimale | |
$bin = 0b11111; // binario | |
$neg = -125; | |
echo $dec."\n"; // 40 | |
echo $oct."\n"; // 209 | |
echo $hex."\n"; // 188 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$isLoaded = 1; | |
if ($isLoaded) { | |
echo "Carico\n"; | |
} else { | |
echo "Non carico\n"; | |
} | |
// Output: Carico |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$isLoaded = true; | |
if ($isLoaded) { | |
echo "Carico"; | |
} else { | |
echo "Non carico"; | |
} | |
// Output: Carico |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Questo è un commento | |
# Questo è un altro commento | |
/* | |
Autore: Flavio | |
Linguaggio: PHP | |
Oggetto: Commento su più righe | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('SOFTWARE_VERSION', 7.2); | |
echo "Versione del software ".SOFTWARE_VERSION; | |
//Output: Versione del software 7.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$name = 'Flavio'; | |
$age = 36; | |
$_country = 'Italia'; | |
$car1 = 'Clio'; | |
echo "Il mio nome è $name, vivo in $_country, ho $age anni e guido una $car1"; | |
//Output: Il mio nome è Flavio, vivo in Italia, ho 36 anni e guido una Clio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$string = "foo"; | |
$integer = 0; | |
echo "$string è ".gettype($string).", $integer è ".gettype($integer); // foo è string, 0 è integer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$string = 'foo'; | |
$integer = 0; | |
if ($string == $integer) { | |
echo "I valori sono uguali"; | |
} else { | |
echo "I valori non sono uguali"; | |
} |