If you look at the usage for this library, https://github.com/Gregwar/Formidable
You have,
$form = new Gregwar\Formidable\Form('forms/example.html');
$form->handle(function() {
echo "Form OK!";
}, function($errors) {
echo "Errors: <br/>";
foreach ($errors as $error) {
echo "$error<br />";
}
});
echo $form;
My question is, how is this done? How do you echo the $form object..
for eg if I have
class Something
{
public $somevariable = 'London';
public function __construct()
{
$this->foo();
}
public function foo(){
//Do Something
}
}
$myObj = new Something();
echo $myObj;
The above code gives me an error. What can I do to echo $myObj and not get an error so I can have something displayed on the screen?
We all know we can do something like,
echo $myObj->somevariable;
without an error.. How can I do
echo $myObj;
without getting an error as it is done in the Formidable library.