Get PHP Array Value

2
Array
(
    [0] => 
    [1] => Array
        (
            [0] => #EXTM3U
        )
    [2] => Array
        (
            [0] => #EXTINF:-1 tvg-id="" tvg-name="BBB 18 -Aquecimento" tvg-logo"https://s9.postimg.org/4c14egx5b/big_welcome_Pic_4-300x169.png" group-title="Canais Globo",BBB 18 -Aquecimento (...)
        )

    [3] => Array
        (
            [0] => http://infinity.quor8.com:8000/live/N708Kwo02j/qsTfBzzoPk/12664.ts
        )

    [4] => Array
        (
            [0] => #EXTINF:-1 tvg-id="" tvg-name="Globo RJ FHD" tvg-logo="http://i.imgur.com/NSHvLCe.png" group-title="Canais Globo",Globo RJ FHD
        )
)

I have this array above and I need only get the value of tvg-logo

I tried this way here: $array[2][tvg-logo];

But the result was this:

#EXTINF:-1 tvg-id="" tvg-name="BBB 18 -Aquecimento" tvg-logo="https://s9.postimg.org/4c14egx5b/big_Welcome_Pic_4-300x169.png" group-title="Canais Globo",BBB 18 -Aquecimento

As I said, I only need the value of tvg-logo

Can anyone help?

    
asked by anonymous 15.01.2018 / 15:14

2 answers

0

You can use the parser function and save each part of the String of the array to a variable, using the function:

void parse_str ( string $encoded_string [, array &$result ] )

In your case: Accessing the value of $ array [0] [2]

You have: "EXTINF: -1 tvg-id=" "tvg-name=" BBB 18 -Warming "tvg-logo=" https://s9.postimg.org/4c14egx5b/big_Welcome_Pic_4-300x169 .png "group-title=" Canals Globo ", BBB 18 -Warmening";

With this you can:

parse_str($suaString, $resultado);

...
echo $resultado['tvg-id']; // ""
echo $resultado['tvg-name']; // "BBB 18 -Aquecimento
echo $resultado['tvg-logo']; // https://s9.postimg.org/4c14egx5b/big_Welcome_Pic_4-300x169.png
...
    
15.01.2018 / 15:50
0

The final resolution to what I wanted to look like this:

$string_antiga = $array[10][0]; 

preg_match_all("/\"[^\"]*\"/",$string_antiga,$x);
echo '<pre>'; print_r($x);

echo $x[0][2];

Thank you to everyone who tried to help.

    
15.01.2018 / 18:12