php - trouble printing sequence of numbers to the pattern -
I am trying to print the following sequence with php.
So far my code is :
$ last = 1; ($ J = 1; $ j $ 5; $ j ++) {for ($ i = 0; $ i & lt; 14; ++ $ i) {If ($ i% 4 == 0) { Echo "* ***********"; } If ($ i + $ last> 14) {$ last = - $ i + 1; } $ I + $ End Echo. ","; } Echo "& lt; / br & gt;"; $ Final = $ i + $ previous -2; If ($ last> 14) {$ last = 1; }}
The code above generates something that is what I want.
< Div class = "post-text" itemprop = "text">
It looks like this job:
$ len = 14; Forex currency (range as 0, 6) $ day) {$ start = ($ day * 4 + 1)% $ len; $ Rng = array_slice (array_merge (category ($ start, $ lane), category (1, $ start)), 0, $ lane; $ Cols = [$ day + 1]; Foreign currency (array_chunk ($ rng, 4) $ c) $ cols [] = implode (',', $ c); Echo Fetal ('|', $ cols), "\ n"; }
Result:
1 | 1,2,3,4 | 5,6,7,8 9,10,11,12. 13,14 2 5,6,7,8 9,10,11,12. 13,14,1,2 3,4 3 | 9,10,11,12. 13,14,1,2 3,4,5,6 7,8,4 13,14,1,2 3,4,5,6 7,8,9,10 11,12 5 3,4,5,6 7,8,9,10 11,12,13,14 1,2 6 | 7,8,9,10 11,12,13,14 1,2,3,4 | 5,6 7 11,12,13,14 1,2,3,4 | 5,6,7,8 9, 10
Comments
Post a Comment