forked from joostvanveen/php-oop-fundamentals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
32 lines (23 loc) · 772 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
// Require app files
require 'app/Helper.php';
// Set data and validation rules
$rules = array('email' => 'required|email', 'password' => 'required|min:8');
$data = array('email' => '[email protected]', 'password' => '12346789', 'foo' => 'bar');
// Run validation
$validator = new Validator();
if ($validator->validate($data, $rules) == true) {
// Validation passed. Set user values.
$joost = new User($data);
$joost->email = '[email protected]';
$joost->password = 'sadfsadfsad';
// var_dump($joost->email);
// var_dump($joost->password);
// Dump user
// var_dump($joost);
echo $joost;
}
else {
// Validation failed. Dump validation errors.
var_dump($validator->getErrors());
}