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

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -