<?php
class Test1 {
static string $type = '789';
public function __construct() {
$this->type = '123';
}
public function changeType() {
$this->type = '456';
}
public function main() {
$this->changeType();
echo $this->type;
}
public function main2() {
echo self::$type;
}
}
$test = new Test1();
$test->main2();