Re: Question About Array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
you can display the array values with the HTML table.

The solution is following:
<?PHP
$country=array("USA","KSA","SYR","GER","EGY","JPA","CHA","PAK");
?>
<table width="50%" cellpadding="0" cellspacing="0" bgcolor="#66CCFF"
align="center" border="1">
    <tr>
    <?PHP
    $ctr = 0;

    foreach($country as $val)
    {
        $ctr++;
    ?>
        <td style="border: solid 1px #FFFFCC;">
            <?PHP echo $val;?>
        </td>
        <?PHP if ($ctr == 3 )
        {
            $ctr = 0;
            echo "</tr><tr>";
        }
    }
    ?>
</table>

You can customize it to you accordingly.

Thanks & Regards
Neeraj Jain

On Tue, Dec 8, 2009 at 6:56 PM, saeedos <saeedos@xxxxxxxxx> wrote:

>
>
> Hi all ,
> i have this Array :
> $country=array("USA","KSA","SYR","GER","EGY","JPA","CHA","PAK");
>
> // I want the output of this array looks like this :
>
> USA KSA SYR
> GER EGY JPA
> CHA PAK
>
> i know it's can be done in Nested for loops , but i don't know how .
>
> thanks
>
>  
>


[Non-text portions of this message have been removed]



------------------------------------

Are you looking for a PHP job?
Join the PHP Professionals directory Now!
http://www.phpclasses.org/jobs/
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/php-objects/join
    (Yahoo! ID required)

<*> To change settings via email:
    php-objects-digest@xxxxxxxxxxxxxxx 
    php-objects-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux