Z
Z
zhyshy2019-10-15 16:03:20
PHP
zhyshy, 2019-10-15 16:03:20

How to sort output in php (modx)?

Good afternoon!
There is this code

{foreach $car.prices as $tariff}
   <li>
      <span>{$tariff.count} дней: {$tariff.price} руб.</span>
   </li>
{/foreach}

{$tariff.count} contains a digit, how to infer ascending relative to the digit in {$tariff.count}?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Araik, 2019-10-15
@NinjaNickName

The code you provided is the template code ( for the interpretation of which the template engine is responsible ), you need to sort using sort \ usort before giving the data to the template

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question