- 当右侧表达式为无类型但左侧变量已有已知原生类型时, 使用左侧类型进行转换以确保类型安全 - 在赋值操作中添加类型检查逻辑,避免类型丢失问题 - 更新 fibo 和 fibo_r 函数参数类型声明为 int - 添加 issetor 性能测试用例以验证类型推断优化效果pull/1/head
parent
5e549a4c15
commit
c5f38a3d05
3 changed files with 28 additions and 2 deletions
@ -0,0 +1,15 @@ |
|||||||
|
<?php |
||||||
|
function issetor(int $n) |
||||||
|
{ |
||||||
|
$val = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); |
||||||
|
for ($i = 0; $i < $n; ++$i) { |
||||||
|
$x = $val ?: null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function main() |
||||||
|
{ |
||||||
|
$s = microtime( true); |
||||||
|
issetor(1000_0000); |
||||||
|
echo microtime( true) - $s . "\n"; |
||||||
|
} |
||||||
Loading…
Reference in new issue