In my Yii2 Project I have an array for example
$array = [];
$array [] = 8 , 3, 6
So when I print out the array is
[8,3,6]
So when I use the same in a where statement it jumbles up.
$class = ModelClass::find()->where(['array_no' => $array])->all
So when I print out class I get the output in asc order sorted.. I get the information of
- 3 in the first
- 6 in the second place
- 8 in the third place.
How can i stop this from happening. I want them to return my output in the same order as array
orderBylike this stackoverflow.com/questions/28856562/order-by-field-in-yii2. Just create an expression with your array and pass it to order by statement.