A
A
Andrey Angelovich Stock2018-03-21 12:50:52
PHP
Andrey Angelovich Stock, 2018-03-21 12:50:52

Counting and outputting array elements?

Hello. it is necessary to display sorted and combined data of several arrays. do not know how. Essence. from the API, I get from one to ten responses in the form of json arrays. Array example:

{
        "results": [
        {
            "position": "1",
            "url": "https:\/\/www.pizzahut.com\/",
            "title": null,
            "snippet": "<span>Order pizza online for fast pizza delivery or drop by for carryout. You may also 
\ncontact Pizza Hut and find out about our catering services for your next big event.<\/span>"
        },
        {
            "position": "2",
            "url": "https:\/\/www.dominos.com\/",
            "title": null,
            "snippet": "<span>Domino's Home Page - Domino's Pizza, Order Pizza Online for Delivery - 
\nDominos.com.<\/span>"
        },
            ...
        ]
    }

There are 100 arrays in this array. And (I repeat) there are from one to ten such json arrays. I need to get the first ten URLs from each such array and display these URLs in a table, but output so that frequently repeated URLs are at the top, and non-repeated ones at the bottom. sort of in descending order of repetition. Please tell me how can this be implemented.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Epifanov, 2018-03-21
@kacheleff

implementation example

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question