title: How to change VAR?
body: <p>I've got a part of a PHP script, but it gives a T_CLASS error.</p>
  
  <p>But i'm not sure how to convert the VAR element into a php5 compliant code...
  Can somebody help me?</p>
  
  <pre><code>&lt;?php // Defining the "calc" class
  if (!class_exists('calc'))
  class calc {
  var $number1;
  }
  ?&gt;
  </code></pre>
  
  <p>p.s. this is just part of a bigger code, but it keeps saying: "PHP Syntax Check: Parse error: syntax error, unexpected T_CLASS in your code on line 3". So the error should be either in "class calc {" or in "var $number1;". Please help :P</p>
  
  <p>I had to place the entire code. Just adding the brackets gave me a new error. </p>
  
  <pre><code>&lt;?php // Defining the "calc" class
  if (class_exists('calc')) {
  class calc {
  var $number1;
  }
  }
  function boek($number1)
  {
  $result =$number1 * 2;
  echo "Om een tekst van $number1 pagina's te redigeren, rekenen wij: &lt;strong&gt;€ $result,-*&lt;/strong&gt;&lt;/br&gt;";
  echo "&lt;small&gt;*Deze prijs is slechts een indicatie. Om een vrijblijvende offerte aan te vragen kunt u gebruikmaken van het contactformulier onderaan de pagina. &lt;br/&gt;&lt;span style=\"text-decoration: underline;\"&gt;Let op: studenten krijgen op vertoon van hun studentenpas 25% korting.&lt;/span&gt;&lt;/small&gt;";
  }
  }
  //Creating object of class
  $calc = new calc();
  ?&gt;
  &lt;style type="text/css"&gt;
  .calcbutton {
  Cursor: pointer;
      display: block;
      text-indent: -5000px;
      width: 136px;
      height: 44px;
      border: none;
      background-image: url('http://www.mijncreaties.com/wp-content/themes/GoedVerwoord/images/buttons.png');
      background-repeat: no-repeat;
  }
  .calcbutton {background-position: top left;}
  .calcbutton:hover {background-position: center left;}
  .calcbutton:active {background-position: bottom left;}
  &lt;/style&gt;
  &lt;form name="calc" action="" method="POST"&gt;
  &lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt;Aantal pagina's: &lt;/td&gt;
          &lt;td&gt;&lt;input type="text" style="padding-left: 3px;" class="calc-form wpcf7-text" name="value1" value="0" onfocus="if (this.value == '0') {this.value = '';}" onblur="if (this.value == '') {this.value = '0';}"&gt;&lt;br&gt;
          &lt;input type="hidden" name="oper" value="boek"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  &lt;input type="submit" value="Bereken prijs" name="submit" class="calcbutton"&gt;
  &lt;/form&gt;
  &lt;?
  
  if($_POST['submit']){
  $number1 = $_POST['value1'];
  $oper = $_POST['oper'];
  if(!$number1){
  echo "&lt;p&gt;&lt;font color=\"red\"&gt;Vul a.u.b. een getal in.&lt;/font&gt;&lt;/p&gt;";
  }
  if($oper == "boek"){
  $calc-&gt;boek($number1);
  }
  }
  ?&gt;
  </code></pre>