title: A PHP Function to display the sum of length of all cookies presented into the request
body: <pre><code>&lt;?php
   setcookie(&quot;Auction_Item&quot;, &quot;Luxury Car&quot;, time()+2*24*60*60); 
  if(isset($_COOKIE[&quot;Auction_Item&quot;])){ 
      echo &quot;Auction Item is a  &quot; . $_COOKIE[&quot;Auction_Item&quot;]; 
  } else{ 
      echo &quot;No items for auction.&quot;; 
  } 
  ?&gt;
  </code></pre>
  <p>Okay so this php code simply sets a cookie and gives the value, I need to write a function that after accepting a boolean parameter as TRUE returns the sum of length of all cookies presented into the request.</p>
  <pre><code>   if ($val = true){
          $cookies = $_COOKIE
               $strVal = &quot;&quot;;
               $countVal = count($cookies);
               for ($x = 0; $x &lt; $countVal; $x++) {
               $strVal = $strVal . $cookies[$x].$val
  }
  echo 'Sum of length of all cookie values'.strlen($strVal)
  </code></pre>
  <p>I've tried this, but it doesn't seem to work.</p>