Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
$rule="{ 'name': 'required', 'email': ['required', 'email'], 'gender': { 'one_of': ['male', 'female'] }, 'phone': {'max_length': 10}, 'password': ['required', {min_length: 10} ], 'password2': { 'equal_to_field': 'password' } }"; var_dump(json_decode($rule, 1));
Результат:
stdClass Object
(
[name] => required
[email] => Array
(
[0] => required
[1] => email
)
[gender] => stdClass Object
(
[one_of] => Array
(
[0] => male
[1] => female
)
)
[phone] => stdClass Object
(
[maxlength] => 10
)
[password] => Array
(
[0] => required
[1] => stdClass Object
(
[minlength] => 10
)
)
[pasword2] => stdClass Object
(
[equal_to_field] => password
)
)