The multisort flag for arrays doesn't work the way I'm trying it. This is how I'm using it.

{% for conv in conversations|multisort(['postDate'],['SORT_DESC']) %}

This is the error I keep getting.

array_multisort(): Argument #2 is expected to be an array or a sort flag

Any ideas?


I think you should change ['SORT_DESC'] to [SORT_DESC]. See this tweet for an example. SORT_DESC is a PHP constant, not a string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.