Skip to content

Instantly share code, notes, and snippets.

View flaviors200's full-sized avatar

Flavio Biscaldi flaviors200

View GitHub Profile
@flaviors200
flaviors200 / oop-example.php
Last active May 7, 2019 00:25
Hello World!
<?php
class Person
{
private $name;
private $lastname;
public __construct($name = null, $lastname = null)
{
$this->name = $name;
@flaviors200
flaviors200 / hello-world.php
Last active May 10, 2019 00:37
Hello World!
<?php
echo "Hello World!";
@flaviors200
flaviors200 / hello-world-html.php
Last active May 10, 2019 00:38
Hello World! with HTML formatting
<html>
<body>
<strong>
<?php
echo "Hello World!";
?>
</strong>
</body>
</html>
@flaviors200
flaviors200 / weak-typing.php
Last active May 10, 2019 01:01
Weak typing
<?php
$string = 'foo';
$integer = 0;
if ($string == $integer) {
echo "I valori sono uguali";
} else {
echo "I valori non sono uguali";
}
@flaviors200
flaviors200 / gettype-function.php
Last active May 10, 2019 01:04
Gettype function
<?php
$string = "foo";
$integer = 0;
echo "$string è ".gettype($string).", $integer è ".gettype($integer); // foo è string, 0 è integer
@flaviors200
flaviors200 / variables.php
Last active May 14, 2019 14:08
Variables
<?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
@flaviors200
flaviors200 / constants.php
Last active May 14, 2019 16:33
PHP Constants
<?php
define('SOFTWARE_VERSION', 7.2);
echo "Versione del software ".SOFTWARE_VERSION;
//Output: Versione del software 7.2
@flaviors200
flaviors200 / comments.php
Created May 14, 2019 21:17
Comments in PHP
<?php
// Questo è un commento
# Questo è un altro commento
/*
Autore: Flavio
Linguaggio: PHP
Oggetto: Commento su più righe
*/
@flaviors200
flaviors200 / boolean.php
Created May 15, 2019 15:30
Boolean type
<?php
$isLoaded = true;
if ($isLoaded) {
echo "Carico";
} else {
echo "Non carico";
}
// Output: Carico
@flaviors200
flaviors200 / float.php
Last active May 15, 2019 23:45
Float data type
<?php
$float = 123.30;
$float2 = 120e-3; // Sintassi con esponente
echo $float."\n";
echo $float2;
/*
Output