hendrikbez Posted August 2, 2022 Share Posted August 2, 2022 I did get help from Barand (moderator) It is working, bur what happened if I have two different or more info after my html link In echo I can have last part as /Token or /address How can I get it to see anyone that must be used <?php $domains = [ "BSCSCAN" => "bscscan.com", "TRONSCAN" => "tronscan.org/#", "DGB" => "dgb.com", "HECOINFO" => "heco.com", "POLYGONSCAN" => "polyn.com", "RVN" => "rvn.com", "ETHERSCAN" => "etherscan.io/address", "THUNDERCORE" => "tttn.com", "SOLSCAN" => "solscan.com" ]; $address = strtolower($checkSqlRow["ADDRESS"]); echo "<td><a href='https://{$domains[$checkSqlRow["BLOCKCHAIN"]]}/token/$address 'style='color:lime' target='_blank' >$address</a></td>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/315123-show-more-than-one-website-with-php-echo/ Share on other sites More sharing options...
requinix Posted August 2, 2022 Share Posted August 2, 2022 What? Rather than this pattern you're starting, which I think you're saying doesn't work, consider sprintf: $domains = [ "BSCSCAN" => "https://bscscan.com/token/%s", "TRONSCAN" => "https://tronscan.org/#/token/%s", "DGB" => "https://dgb.com/token/%s", // ... ]; $url = sprintf($domains[$checkSqlRow["ADDRESS"]], $address); echo "<td><a href='$url' style='color:lime' target='_blank'>$address</a></td>"; Quote Link to comment https://forums.phpfreaks.com/topic/315123-show-more-than-one-website-with-php-echo/#findComment-1598888 Share on other sites More sharing options...
hendrikbez Posted August 3, 2022 Author Share Posted August 3, 2022 Now that I am awake (fully), I just changed something in the href, and it is working. Quote Link to comment https://forums.phpfreaks.com/topic/315123-show-more-than-one-website-with-php-echo/#findComment-1598902 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.