Answer the question
In order to leave comments, you need to log in
Correct foreach?
There is such an array:
Array
(
[6] => Array
(
[sma] => Array
(
[0] => Sma must be a number.
)
[bet] => Array
(
[0] => bet should contain at most 3 characters.
)
)
[10] => Array
(
[dest] => Array
(
[0] => dest must be a number.
)
[bet] => Array
(
[0] => bet should contain at most 3 characters.
)
)
[11] => Array
(
[bet] => Array
(
[0] => bet should contain at most 3 characters.
)
)
)
Yii::$app->getSession()->addFlash(...);
Answer the question
In order to leave comments, you need to log in
foreach ($errors as $key=>$list) {
foreach ($list as $error) {
Yii::$app->getSession()->addFlash($key, $error);
}
}
$result = json_encode($my_array_with_errors, JSON_FORCE_OBJECT);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question