title: php return object of class from a function
body: <p>I'm using this class to create php FORM</p>
  
  <p><a href="http://smarttechdo.com/~avb/pfbc/api/" rel="nofollow noreferrer">http://smarttechdo.com/~avb/pfbc/api/</a></p>
  
  <p>and I need to use this class through function, something like this</p>
  
  <pre><code>function getLogin() {
    Form::open ("login");
      echo "&lt;legend&gt;Login&lt;/legend&gt;";
      Form::Hidden ("id");
      Form::Email ("Email Address:", "email", array("required" =&gt; 1));
      Form::Password ("Password:", "password", array("required" =&gt; 1));
      Form::Checkbox ("", "remember", array("1" =&gt; "Remember me"));
      Form::Button ("Login");
      Form::Button ("Cancel", "button", array("onclick" =&gt; "history.go(-1);"));
    Form::close (false);
  
    return ???
  }
  </code></pre>
  
  <p>How to do that ?</p>
  
  <p>EDIT : I need to return as json data</p>
  
  <pre><code>$var = getLogin();
  echo json_encode($var);
  </code></pre>