正在迭代多维php数组以通过邮件发送


Iterating muldimensional php array to send by mail

我需要发送一封包含$_SESSION 数据的电子邮件

我有这个阵列:

Array ( 
[libelleProduit] => Array 
( [0] => MN 25551 [1] => WHX 4509 [2] => TV15751  [3] => BO22451 )
 [qteProduit] => Array 
( [0] => 1 [1] => 2 [2] => 6 [3] => 1 ) 
[prixProduit] => Array 
( [0] => 189 [1] => 206 [2] => 530 [3] => 375 )

如何循环使用此数组以发送所有数据?我需要能够发送这样的东西:

参考号:MN 25551数量:1价格:189

参考号:WHX 4509数量:2价格:206

参考号:TV15751数量:6价格:530

参考号:BO22451数量:1价格:375

$data = '';
$info = [ 
    'libelleProduit' => [
        0 => 'MN 25551',
        1 => 'WHX 4509',
        2 => 'TV15751',
        3 => 'BO22451',
    ],
    'qteProduit' => [
        0 => 1,
        1 => 2,
        2 => 6,
        3 => 1,
    ],
    'prixProduit' => [
        0 => 189,
        1 => 206,
        2 => 530,
        3 => 375,
    ],
];
foreach($info['libelleProduit'] as $key => $val) {
    $data .= 'ref : ' . $val . ' quantity: ' . $info['qteProduit'][$key] . ' price: ' . $info['prixProduit'][$key] . "'n'n";
}
mail($to , $subject, $data);