- Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
- this is default this is test
<?php
$test = function() :string { return 'this is test' . PHP_EOL;};
class Def {
private $str;
public function __construct(string $str){
$this->str = $str;
}
public function __invoke() {
return $this->str . PHP_EOL;
}
}
function foo (callable $c = new Def('this is default')){
echo $c();
}
foo();
foo($test);