E
E
eellazy2016-08-01 21:12:40
PHP
eellazy, 2016-08-01 21:12:40

How to make individual links?

Hello everyone, I have an array

$webMoney = [ 
  'wmr' => self::$stg['webmoney_r'], 
  'wmz' => self::$stg['webmoney_u'], 
  'wmu' => self::$stg['webmoney_z'],
];

And tsyk in which these elements are displayed.
<?php foreach( $webMoney as $key => $value ) : ?>
 <li>
<a href="#<?=$key?>" tabindex="-1" data-toggle="tab">
Пополнить через <?=$key?>
</a>
</li>
<?php endforeach ?>

I want to write each link separately. Do not display them in an array, but display them as full-fledged 3 links
. It should be like this. I know it's not right, but I'm trying to explain what I want
<a href="#<'wmr' => self::$stg['webmoney_r'], >" tabindex="-1" data-toggle="tab">Пополнить через <?=$key?></a>
<a href="#'wmu' => self::$stg['webmoney_u'], >" tabindex="-1" data-toggle="tab">Пополнить через <?=$key?></a>
<a href="#'wmr' => self::$stg['webmoney_z'], " tabindex="-1" data-toggle="tab">Пополнить через <?=$key?></a>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Koryukov, 2016-08-01
@MadridianFox

If the question is only how to do without a loop and insert values ​​into html tags, then here:

<a href="#wmr" tabindex="-1" data-toggle="tab">Пополнить через <?=$webMoney['wmr']?></a>
<a href="#wmu" tabindex="-1" data-toggle="tab">Пополнить через <?=$webMoney['wmu']?></a>
<a href="#wmz" tabindex="-1" data-toggle="tab">Пополнить через <?=$webMoney['wmz']?></a>

However, exactly the same result can be achieved using a loop:
<?foreach( $webMoney as $key => $value ) : ?>
    <a href="#<?=$key?>" tabindex="-1" data-toggle="tab">Пополнить через <?=$value?></a>
<?endforeach?>

after all, such a cycle displays the text and on the page you get exactly the same as you say "full" links

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question