这段 Laravel 容器程序会输出什么?

来自 Laravel
Laravel 13.30.1 / PHP 8.3.33 入门 2分钟

这段 Laravel 容器程序会输出什么?

php
<?php
use Illuminate\Container\Container;

interface Clock
{
    public function now(): string;
}

final class FixedClock implements Clock
{
    public function now(): string { return '10:00'; }
}

$container = new Container();
$container->bind(Clock::class, FixedClock::class);
$first = $container->make(Clock::class);
$second = $container->make(Clock::class);

echo $first->now(), "\n";
echo $first === $second ? "same\n" : "different\n";
在试验场中打开
报告错误