title: $session data returns only 0
body: <p>I'm trying to put a script together that will do some math for the user.<br>
  That works fine however when i try to put it in a session and try to show the value to the user it will only return 0 if its set to 0.<br>
  <br>
  Does anybody know where i did wrong?<br></p>
  
  <pre><code>&lt;?php
  session_start();
  if( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ){            
  $class1 = filter_var($_POST['class1'], FILTER_SANITIZE_STRING);
  $class2 = filter_var($_POST['class2'], FILTER_SANITIZE_STRING);
  $class3 = filter_var($_POST['class3'], FILTER_SANITIZE_STRING);
  $class4 = filter_var($_POST['class4'], FILTER_SANITIZE_STRING);
  $class5 = filter_var($_POST['class5'], FILTER_SANITIZE_STRING);
  $class1C = $class1 * 35;
  $class2C = $class2 * 5;
  $class3C = $class3 * 7.5;
  $class4C = $class4 * 26;
  $class5C = $class5 * 2.5;
  $totaal1 = $class1C + $class2C + $class3C + $class4C + $class5C;
  
  $res = array($class1C, $class2C, $class3C, $class4C, $class5C, $totaal1);
  foreach($res as $name =&gt; $var) {
  $_SESSION[$name] = $var;
  }
  
  
  $result = array("error" =&gt; false, "html" =&gt; null);
  $result["error"] = false;
  $result["html"] = "&lt;h3&gt;Session information: var_dump($_SESSION[$class1C]) ($_SESSION[$class2C]) ($_SESSION[$totaal1])&lt;/h3&gt;";
  } else {
  $result["error"] = true;
  $result["html"] = "&lt;h3&gt;Error&lt;/h3&gt;";
  }
  echo json_encode($result);
  exit;
  ?&gt;
  </code></pre>