I have a 2d array in a session variable:
$_session['multi'][] = array('item0 ' , 'price0');
$_session['counter']++;
$_session['multi'][] = array('item1 ' , 'price1');
$_session['counter']++;
I want to be able to show the array (and put them in the database) like this:
$_session['multi'][0][0] , $_session['multi'][0][1]
$_session['multi'][1][0] , $_session['multi'][1][1]
.
.
.
I am using a for loop to do that:
for(){
show $_session['multi][i][0] , $_session['multi][i][1]
}
But I have to carry a session (counter) with the number of the rows around to use it with the for loop.
Is there any way to get the number of the rows so I can lose the counter?
If you just want the number of items in
$_SESSION['multi']it’s as simple as: