switch ($_POST['operator']) {
//...
case 'add':
$result = $calculator->add($_POST['first'], $_POST['second']);
break;
$adapter = new \Zend\Db\Adapter\Adapter(array(
'driver' => 'Mysqli',
'database' => 'users_db',
'username' => 'root',
'password' => ''
));
$validator = new RecordExists(array(
'table' => 'users',
'field' => 'username',
'adapter' => $adapter,
));
var_dump($validator->isValid('keanor));