创建一个函数来输出3个变量的所有迭代

I am working on a web app which queries a mySQL db and outputs results in a table based on 3 different variable arrays. Right now I have every iteration as a separate call and I would like to find a way to roll it into a single function if possible.

Here are the parameters I am working with.

$gender = array('male', 'female');
$age = array('adult', 'child', 'senior');
$hairColor = array('black', 'brown', 'blond', 'red', 'bald');

What I am looking to do is output each iteration as a row in a table.

male     adult     black    data_one    data_two
male    adult     brown     data_one    data_two
male     adult     blond     data_one    data_two
female     child     red     data_one    data_two
(etc)...

Here is the code I have:

$result = mysqli_query($connection, "SELECT * FROM profile_table WHERE `gender`='male' AND `age`='adult' AND `hair_color`= 'black' AND `data_one`='$data_one' AND `data_two`='$data_two'");

echo '<tr><td>Male</td>';
echo '<td>Adult</td>';
echo '<td>Black</td>';

formVariables($data_one, $data_two);

How would I convert the currently static data into variables that would output all iterations?

Thanks for any help you can provide.

I don't understand the point of this question, anyway here's a code that will mix these for you

function mix ($gender, $age, $hairColor) {
    foreach( $gender as $g ) {
        foreach( $age as $a ) {
            foreach( $hairColor as $h ) {
                echo "$g\t$a\t$h" . PHP_EOL;
            }
        }
    }
}