jeudi 11 juin 2015

random and combine array with condition php

For example, I have two arrays like this:

$arr1 = array('A','B','C','D','E');
$arr2 = array('F','G','H','I','J');

I want to combine and random two arrays with conditions. If the condition = 4, $arr1 should be 4 values with same index, so $arr2 must sent 1 value random with same index to. For example:

$arr3 = array('A','B','C','I','E');

or

$arr3 = array('F','B','C','D','E');

or if condition = 1 must be like this

$arr3 = array('F','G','C','I','J');

or

$arr3 = array('F','G','H','I','E');

*sorry if you don't understand what I say (use google translate).




Aucun commentaire:

Enregistrer un commentaire