Let's assume the following -simplified- string: 'Xyy'.
Starting from this, I would like to exchange all 'y' with all possible combinations of 0 and 1 (also simplified).
Accordingly, the result should be: X00, X01, X10, X11.
Thank you!
Let's assume the following -simplified- string: 'Xyy'.
Starting from this, I would like to exchange all 'y' with all possible combinations of 0 and 1 (also simplified).
Accordingly, the result should be: X00, X01, X10, X11.
Thank you!
 
    
    Something like this:
function gen() {      
    for($i=0;$i<=1;$i++) { 
        for($j=0;$j<=1;$j++) {    
            yield "X{$i}{$j}";     
        } 
    }                                                                 
}
and invoke it like so:
   foreach(gen() as $val) {                     
       echo $val . " ";    
   }  
