'How to Iterate array with special characters

$referral_leaderboard = $db->query("SELECT referrer, COUNT(*) FROM users WHERE NOT referrer = '' GROUP BY referrer ORDER BY COUNT(*) DESC")->fetchAll();

Here is the value of my array that is set up by the controller:

Array
(
    [0] => Array
        (
            [referrer] => 9b71b93bc24e6340
            [0] => 9b71b93bc24e6340
            [COUNT(*)] => 3
            [1] => 3
        )

    [1] => Array
        (
            [referrer] => 958b0ac6f9883951
            [0] => 958b0ac6f9883951
            [COUNT(*)] => 1
            [1] => 1
        )

    [2] => Array
        (
            [referrer] => 893134b7cb7a4146
            [0] => 893134b7cb7a4146
            [COUNT(*)] => 1
            [1] => 1
        )

)

The array above is stored in this variable = $referral_leaderboard

so when I print it in my twig file it should be like this: {{ referral_leaderboard }}

{{ referral_leaderboard }} is an Array

Now in my twig file, I want to iterate through the array, Here is my code but did not work:

{% for row in referral_leaderboard %}
    <tbody>
        <tr>
            <td>{{ row.referrer }}</td>
        </tr>

        <tr>
            <td>{{ row.COUNT(*) }}</td>
        </tr>
    </tbody>
    
{% endfor %}

EDIT: row.referrer is working but row.COUNT(*) is not working. Maybe because of the special character (*). So i tried this still did not work row.COUNT\(\*\)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source