How to display selected items with foreach loop or any other loop in php/wordpress -


i sorry searched long time , haven't got answer of problem. please me. issue -

i have array looping through "foreach". works absolutely fine. want display predefined items loop. example;

my loop is,

<?php $info = array ('name', 'age'); if (isset ($info) ) {   foreach ($info $new_info) {?>      <p><?php echo $new_info['name'] . ", " . $new_info['age']; ?></p>  <?php }} ?> 

this outputs correctly -

name1, age1 name2, age2 name3, age3 name4, age4 

.... , on. dynamic, want display specific items this. like, want display 2nd , 4th item (or other) loop. loop should output -

name2, age2 name4, age4 

i don't know how that. can me? new php coding.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -