<p>I think you should change <code>['SORT_DESC']</code> to <code>[SORT_DESC]</code>. See <a href="https://twitter.com/nystudio107/status/1020719464147570688" rel="nofollow noreferrer">this tweet</a> for an example. <code>SORT_DESC</code> is a PHP constant, not a string.</p>

CC BY-SA 4.0
2019-04-16T09:16:02.103Z
2019-04-16T09:16:02.103Z
Paul
<p>The multisort flag for arrays doesn't work the way I'm trying it. This is how I'm using it.</p>

<p><code>{% for conv in conversations|multisort(['postDate'],['SORT_DESC']) %}</code></p>

<p>This is the error I keep getting.</p>

<p><strong>array_multisort(): Argument #2 is expected to be an array or a sort flag</strong></p>

<p>Any ideas?</p>

<array><multisort>
Multisort flag doesn't seem to work
# Multisort flag doesn't seem to work

(Asked by: username_0 on 2019-04-16)

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?

**Tags:** array, multisort


---

## 1 answers

### Answer by username_1 on 2019-04-16. Score: 1

I think you should change `['SORT_DESC']` to `[SORT_DESC]`. See [this tweet](https://twitter.com/nystudio107/status/1020719464147570688) for an example. `SORT_DESC` is a PHP constant, not a string.


---

