php - Manipulate session multi-array -


i wanna manipulate each variable inside array. dont know how take value each array.

    <?php     session_start();     /*array  name, howmuch, cost*/     $_session['id'][] = array("soup", 3 , 1.25);     $_session['id'][] = array("puos", 1 , 3.25);      foreach ($_session['id'] $product=>$value){          foreach ($value $var)        {            /*here echo ("ur product ". name );                   echo (howmuch);                   echo (costo*0.40 );  */         }      echo ("<br>"); }       session_destroy();   ?> 

grettings all.

// loop $product reference foreach ($_session['id'] &$product) {    // 60% discount on every price    $product[2] *= 0.4; } 

or

// use full path each value changed foreach ($_session['id'] $key=>$product) {    // 60% discount on every price    $_session['id'][$key][2] *= 0.4; } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -