php - Session array with productids -


i'm adding product ids session array with:

if (isset($_get["add"]) && (int)$_get["add"]>0) { $_session['products'][] = $_get["add"]; } 

how loop array , add class products ids in array?

what this:

... $_session['products'][$_get["add"]] = true ; ... 

then ask

if ($_session['products']) { ... } 

or in loop

foreach ($_session['products'] $id=>$isset) { // ... } 

btw shorter cond:

if (($_get["add"]*1)>0) 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -