3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ct($array) { var_dump('1'); return count($array); } $ar = [1,2,3,4,5,6]; for ($counter = 0, $length = ct($ar); $counter < $length; $counter++) { var_dump('loop'); }
based on r3ane
Output for 7.2.0 - 7.2.31, 7.3.0 - 7.3.19, 7.4.0 - 7.4.7, 8.0.0alpha1 - alpha2
string(1) "1" string(4) "loop" string(4) "loop" string(4) "loop" string(4) "loop" string(4) "loop" string(4) "loop"