3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $n = array(1, 3); $k = 0; $x = 1; $z[] = $x; for ($i = 1; $i < 300; $i++) { $x += $n[$k]; $z[] = $x; if ($k == 0) $k = 1; else $k = 0; } echo implode(',', $z);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
1,2,5,6,9,10,13,14,17,18,21,22,25,26,29,30,33,34,37,38,41,42,45,46,49,50,53,54,57,58,61,62,65,66,69,70,73,74,77,78,81,82,85,86,89,90,93,94,97,98,101,102,105,106,109,110,113,114,117,118,121,122,125,126,129,130,133,134,137,138,141,142,145,146,149,150,153,154,157,158,161,162,165,166,169,170,173,174,177,178,181,182,185,186,189,190,193,194,197,198,201,202,205,206,209,210,213,214,217,218,221,222,225,226,229,230,233,234,237,238,241,242,245,246,249,250,253,254,257,258,261,262,265,266,269,270,273,274,277,278,281,282,285,286,289,290,293,294,297,298,301,302,305,306,309,310,313,314,317,318,321,322,325,326,329,330,333,334,337,338,341,342,345,346,349,350,353,354,357,358,361,362,365,366,369,370,373,374,377,378,381,382,385,386,389,390,393,394,397,398,401,402,405,406,409,410,413,414,417,418,421,422,425,426,429,430,433,434,437,438,441,442,445,446,449,450,453,454,457,458,461,462,465,466,469,470,473,474,477,478,481,482,485,486,489,490,493,494,497,498,501,502,505,506,509,510,513,514,517,518,521,522,525,526,529,530,533,534,537,538,541,542,545,546,549,550,553,554,557,558,561,562,565,566,569,570,573,574,577,578,581,582,585,586,589,590,593,594,597,598