3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fn4 = fn ($totalCount) => sqrt($totalCount) - sqrt(1); $total = 1; for ($i = 1; $i <= 20; $i++) { echo sqrt($i) - sqrt(1); // echo "$total: " . ceil($fn4($i)); echo "\n"; $total++; }
Output for 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
0 0.4142135623731 0.73205080756888 1 1.2360679774998 1.4494897427832 1.6457513110646 1.8284271247462 2 2.1622776601684 2.3166247903554 2.4641016151378 2.605551275464 2.7416573867739 2.8729833462074 3 3.1231056256177 3.2426406871193 3.3588989435407 3.4721359549996

preferences:
43.41 ms | 406 KiB | 5 Q