<?php
// my comment
class Foo {
protected const value = 10;
public function __construct() {
echo "Foo", PHP_EOL;
}
public function getValue() {
return self::value;
}
}
trait MyTrait {
public function __construct() {
echo "MyTrait", PHP_EOL;
}
}
class Bar extends Foo {
use MyTrait;
protected const value = 20;
}
$b = new Bar();
echo $b->getValue();
To embed this program on your website, copy the following code and paste it into your website's HTML: