Skip to content

Instantly share code, notes, and snippets.

@shadowhand
Created June 11, 2009 21:42
Show Gist options
  • Save shadowhand/128256 to your computer and use it in GitHub Desktop.
Save shadowhand/128256 to your computer and use it in GitHub Desktop.
<?php
$form = array(
'username' => 'shadowhand',
'password' => 'foood',
'ip' => '127.0.0.1',
);
$form = Validation::factory($form)
->rules('username', array(
'required' => TRUE,
'regex' => '/\w[\w_.]{2,30}\w/i',
))
->rules('password', array(
'required' => TRUE,
'min_length' => 5,
))
->rules('ip', array(
'ip' => FALSE,
));
$errors = array();
echo Kohana::debug($form->validate($errors), $errors);
echo Kohana::debug($form->as_array());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment