how can I print multiple services in this way

You insert services/prices as another array. So use this and it will be ok:

I want to print both result in php

In file A

$_SESSION['cart']['prices'][] = '1000';

$_SESSION['cart']['services'][] = 'game';

In File B

$_SESSION['cart']['prices'][] = '2000';

$_SESSION['cart']['services'][] = 'game2';

In file C

foreach ($_SESSION['cart']['services'] as $key => $service) {
  echo $service . ' = ' . $_SESSION['cart']['prices'][$key] . '<br />';
}

Leave a Comment