And so you code…

1 comment to And so you code…

  • With this code you can print the combinations between two arrays in one way,

    <?php
    $option1 = array('in the park','on the beach');
    $option2 = array('Play ','Walk');

    $max1 = sizeof($option1);
    $max2 = sizeof($option2);

    for($j=0; $j<$max2; $j++) {

    for ($i=0;$i<$max1;$i++) {
    echo $option2[$i];
    echo " ".$option1[$j]."”;
    }
    echo “”;
    }

    ?>

    Result:

    Play in the park
    Walk in the park

    Play on the beach
    Walk on the beach

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Categories

Archives

Calendar

August 2017
M T W T F S S
« Jul    
 123456
78910111213
14151617181920
21222324252627
28293031