I wanted to print the name of the coin (obtained from a JSON response of a site) + "test" when the page is loaded; the problem is that only "test" is printed as if it did not find the name of the coin.
PHP code:
<?php
     $coinbase = "https://api.coinmarketcap.com/v1/ticker";
     $array = array("/bitcoin","/ethereum");
     find();
     function find(){
         $coin = file_get_contents($GLOBALS["coinbase"].$array[1]);
         $coin = json_decode($coin, TRUE);
         $v = $coin['name']."test";
         echo $v;
     }
?>
JSON structure:
[
   {
      id: "bitcoin-cash",
      name: "Bitcoin Cash",
      symbol: "BCH",
      rank: "4",
      price_usd: "1042.72",
      price_btc: "0.114721",
      24h_volume_usd: "462221000.0",
      market_cap_usd: "17742232718.0",
      available_supply: "17015338.0",
      total_supply: "17015338.0",
      max_supply: "21000000.0",
      percent_change_1h: "1.59",
      percent_change_24h: "-4.49",
      percent_change_7d: "-14.31",
      last_updated: "1520950752"
   }
]