Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8227325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:05:34+00:00 2026-06-07T16:05:34+00:00

<ul class=selectplanparagraph> <li> <h3><?php echo $comparetxt[0][0]; ?></h3> <img width=280 height=80 src=<?php echo $comparetxt[0][1]; ?>

  • 0
<ul class="selectplanparagraph">
<li>
    <h3><?php echo $comparetxt[0][0]; ?></h3>
    <img width="280" height="80" src="<?php echo $comparetxt[0][1]; ?>" alt="">
    <p><?php echo $comparetxt[0][2]; ?></p>
</li>
<li>
    <h3><?php echo $comparetxt[1][0]; ?></h3>
    <img width="280" height="80" src="<?php echo $comparetxt[1][1]; ?>" alt="">
    <p><?php echo $comparetxt[1][2]; ?></p>
</li>
<li>
    <h3><?php echo $comparetxt[2][0]; ?></h3>
    <img width="280" height="80" src="<?php echo $comparetxt[2][1]; ?>" alt="">
    <p><?php echo $comparetxt[2][2]; ?></p>
</li>
<!-- End .selectplanparagraph --></ul>

I would like to loop this instead of having 3 LI with hardcoded positions in array, I’d prefer to make a simple loop. I tried but I failed. This loops with arrays are more complicated than I thought 🙂 at least for me beginner 🙂

array looks like this:

$comparetxt = [ 
    [ "Title 1", "url 1", "text 1" ],
    [ "Title 2", "url 2", "text 2" ],
    [ "Title 3", "url 3", "text 3" ]
];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:05:35+00:00Added an answer on June 7, 2026 at 4:05 pm

    First of all it seems like your array notation is wrong. Try this

    <?php
    $comparetxt = array(
        array('title' => 'Title 1', 'url' => 'www.google.com', 'text' => 'text 1'),
        array('title' => 'Title 2', 'url' => 'www.google.com', 'text' => 'text 2'),
        array('title' => 'Title 3', 'url' => 'www.google.com', 'text' => 'text 3')
    );
    ?>
    <ul class="selectplanparagraph">
    <?php foreach($comparetxt as $compare) { ?>
    <li>
    <h3><?php echo $compare['title']; ?></h3>
    <img width="280" height="80" src="<?php echo $compare['url']; ?>" alt="">
    <p><?php echo $compare['text']; ?></p>
    </li>
    <?php } ?>
    </ul>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

class A attr_accessor :dab .... end Now I have an array of instances of
class Person < ActiveRecord::Base validates :terms_of_service, :acceptance => true end In the above, what
class Size{ Size(){ } //public final Size SMALL = new Size();//infinite loop final Size
class Client < ActiveRecord::Base has_many :hosts, :dependent => :destroy end class Host < ActiveRecord::Base
class A def initialize @x = do_something end def do_something 42 end end How
class CartesianProduct include Enumerable # your code here end #Examples of use c =
class Transaction < ActiveRecord::Base belongs_to :account, :polymorphic => true end class Bankaccount < ActiveRecord::Base
class Account def initialize(starting_balance = 0) @balance = starting_balance end def balance #instance getter
class A def initialize print Hello! end end class B < A def initialize(name)
class Widget; std::vector< std::shared_ptr<Widget> > container class Criterium { public: bool operator()(const Widget& left,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.