Ejemplo n.º 1
0
<?php

declare (strict_types=1);
interface Product
{
    static function getPrice() : float;
}
class Pen implements Product
{
    static function getPrice() : float
    {
        return [];
    }
}
var_dump(Pen::getPrice());
Ejemplo n.º 2
0
<?php

class Pen
{
    public $color = "blue";
    function write()
    {
        echo "<div style='color: {$this->color}'> I am writing </div>";
    }
}
$pen = new Pen();
$pen->write();