I'm running a small loop to get the number of items in an array stored in local storage. Then passed to a Session Variable. I tried using Count() but that threw an error. So I then tried this code but I get the following error:- Any clues?
Warning: Invalid argument supplied for foreach() in --etc. directory code line
$ItemCount = 0;
        $Data = json_decode($_SESSION['ItemArray']);
        foreach($Data as $item){
            $ItemCount = $ItemCount+1;
        }
 
    