Jump to content

Creating a table from array


-Karl-

Recommended Posts

Okay, I have an array.

 

Doing print_r($array); shows:

 

Array ( [1.2GHZ CPU

384 Mb Guranteed RAM

512 Mb Burstable RAM

25 Gb Hard Drive

10 Mbit Connection

Unmetered Premium Bandwidth

No setup fees

Instant activation

Dedicated ip address

Full root access

Directadmin Control panel

Free reboot and repair console

Easy to use interface

Free live support

Choice of linux distribution

] => Array ( [0] => ) [1.8GHZ CPU

512 Mb Guranteed RAM

640 Mb Burstable RAM

45 Gb Hard Drive

10 Mbit Connection

Upgradeable to 20Mbit

Unmetered Premium Bandwidth

No setup fees

Instant activation

Dedicated ip address

Full root access

Directadmin Control panel

Free reboot and repair console

Easy to use interface

Free live support

Choice of linux distribution

] => Array ( [1] => ) [2.4GHZ CPU

640 Mb Guranteed RAM

786 Mb Burstable RAM

75 Gb Hard Drive

10 Mbit Connection

Upgradeable to 50Mbit

Unmetered Premium Bandwidth

No setup fees

Instant activation

Dedicated ip address

Full root access

Directadmin Control panel

Free reboot and repair console

Easy to use interface

Free live support

Choice of linux distribution

] => Array ( [2] => ) [3.0GHZ CPU

768 Mb Guranteed RAM

1024 Mb Burstable RAM

125 Gb Hard Drive

20 Mbit Connection

Upgradeable to 100Mbit Unmetered Premium Bandwidth

No setup fees

Instant activation

Dedicated ip address

Full root access

Directadmin Control panel

Free reboot and repair console

Easy to use interface

Free live support

Choice of linux distribution

] => Array ( [3] => ) [4.0GHZ CPU

1024 Mb Guranteed RAM

1536 Mb Burstable RAM

200 Gb Hard Drive

50 Mbit Connection

Upgradeable to 100Mbit Unmetered Premium Bandwidth

No setup fees

Instant activation

Dedicated ip address

Full root access

Directadmin Control panel

Free reboot and repair console

Easy to use interface

Free live support

Choice of linux distribution

] => Array ( [4] => ) [2x4.0GHZ Dual Core CPU

1536 Mb Guranteed RAM

2048 Mb Burstable RAM

300 Gb Hard Drive

100 Mbit Connection

Unmetered Premium Bandwidth

No setup fees

Instant activation

Dedicated ip address

Full root access

Directadmin Control panel

Free reboot and repair console

Easy to use interface

Free live support

Choice of linux distribution

] => Array ( [5] => ) )

 

 

What I'm trying to do is create a table:

 

Features      plan 1                  plan 2

 

Feature 1    1.2GHZ CPU    1.8GHZ CPU

Feature 2      x RAM                x RAM

 

And so on. I've been racking my brains out for hours trying to do this.

 

After starting from scratch again, all I have is:

    $titles = array('CPU Share','Guaranteed RAM','Burstable RAM','HDD Space','Bandwidth');
    $t = 0;
        print_r($Features);
            foreach ($titles as $value) { 
                echo '<tr><td>'.$value.'</td><td>'.$Val[0][0].'</td><td>Package 2</td><td>Package 3</td><td>Package 4</td><td>Package 5</td><td>Package 6</td></tr>';
            }

Link to comment
https://forums.phpfreaks.com/topic/206719-creating-a-table-from-array/
Share on other sites

Theres is only 1 key in your array, you cant break it down...

 

its supose to be

array("Ram" => "384 Mb", "Harddrive"=>"25 Gb");

or

array("384 Mb Guranteed RAM","512 Mb Burstable RAM","25 Gb Hard Drive","Choice of linux distribution");

 

If you need more information regarding Arrays and Multidimensional Array then goto PHP.net/array or http://www.webcheatsheet.com/PHP/multidimensional_arrays.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.