I want to undestand how session arrays working. can u explain below code please.

$_SESSION

I want to undestand what is doing in .
Are they separate arrays or 2-D arrays.

This is a multi-dimensional array. The parent index (ddc) is an associative array and the child (price) is also associative. This would have a single value assigned to it:

$_SESSION['ddc']['price'] = "144";

Note: Unlike a real PHP array, $_SESSION keys at the root level must be valid variable names.

<?php 
$_SESSION[1][1] = 'cake'; // fails

$_SESSION['v1'][1] = 'cake'; // works
?>
Member Avatar for P0lT10n

if you want to see and understand a multi-dimensional array, do this with any multi-dimensional array:

print_r(YOUR ARRAY)

and you will see like a tree your way-array...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.