Задать вопрос
Ответы пользователя по тегу PHP
  • Как выводить только text поле?

    SERGK393
    @SERGK393
    Программист
    Можно использовать array_column
    $curl = curl_init();
    ...
    $response = curl_exec($curl);
    $json = json_decode($response);
        echo mb_convert_encoding($response, 'windows-1251', 'utf-8');//вывод всех полей
        $messages = array_column($json->messages, 'content');
        $messages = array_column($messages, 'text');
        print implode(';', $messages);
    curl_close($curl);

    Здесь с помощью implode пишутся все значения text через точку с запятой (";")
    Ответ написан
    Комментировать