如何在PHP上为paypal项创建一个多维数组,我想从我的会话项循环该项

<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

session_start();

$paypal_url ='https://www.sandbox.paypal.com/cgi-bin/webscr';
$paypal_id = 'rhaffael.ar-facilitator@gmail.com';

$total = count($_SESSION["rooms"]); 

foreach($_SESSION["rooms"] as $product){ 
            $ppid = $product["pid"]; 
            $pname = $product["pname"]; 
            $ppicture = $product["ppicture"]; 
            $time = number_format($product["time"]);

            $total += $product['time'];
        }


$paypal_req = array();
$paypal_req["business"] = $paypal_id;
$paypal_req["rm"] = "2";

this is the main reason why I want to loop the data. cause I have a cart and put the data here.

$paypal_req["item_name"] = "ALIL" , $paypal_req["amount"] = "2000";

Id like to loop this code and put the data from my session

$paypal_req["item_name"] = "ALIL";
$paypal_req["amount"] = "2000";
$paypal_req["no_shipping"] = "1";
$paypal_req["no_note"] = "1";
$paypal_req["handling"] = "0";
$paypal_req["currency_code"] = "PHP";
$paypal_req["lc"] = "PH";
$paypal_req["cbt"] = "Return to the D'One Resort";
$paypal_req["bn"] = "PP-BuyNowBF";
$paypal_req["cancel_return"] = 'http://www.d-oneresort.com/';
$paypal_req["return"] = 'http://www.d-oneresort.com/book1.php';
$paypal_req["notify_url"] = 'http://www.d-oneresort.com/lil_pay/rootipn.php';


//$paypal_req["custom"] = $product_id . "|" . $log_user_id;
$req = "cmd=_xclick";
// Read the post from PayPal
foreach ($paypal_req[2] as $key => $value) 
{
    $value = urlencode(stripslashes($value));
    $req .= "&$key=$value";
}

//echo "Location: " . $paypal_url . "?" . $req;
header("Location: " . $paypal_url . "?" . $req);
?>