php - Foreach loop + recursion -


I'm trying to install this code more flexible so that whatever the size of this $ set array is , I think it can be done with recursive, but the correct php syntax can not be found.

  $ sets = array (array (0, 1, 2, 3), array (0, 1, 2, 3), array (0, 1, 2, 3), array 0, 1, 2, 3)); $ Combination = array (); Forex Currency foreach ($ set [0] as $ s1) ($ set [1] $ s2) foreach ($ set [2] as $ s3) foreach ($ set [3] $ s4 Form) $ combination [] = array ($ S1, $ s2, $ s3, $ s4); Print_r ($ combinations);  

You can do this in a recursive manner like this. Output is similar to your loops

   

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -