How To Display Array Contents

Mobile
feeds
Welcome Login | Register

How To Display Array Contents
  Forums Index
      » PHP Forums
        » » How To Display Array Contents



How To Display Array Contents
Post Description:
Post Tags: how, to, display, array, contents, free php support, php scripts, php questions, php answers, programming, codes, scripts
This Post Has Been Viewed 347 Times Since Mon Feb 11, 2008 1:57 pm Posted By mysql with 4 replies
Next Post »» PHP using for loop to display the contents of an array
How To Display Array Contents
i want to know how i can display or show the contents or the values of an array into one whole output.

for example if i have an array with 5 different values, how can i display what that array holds?

thanks


Leave Your Comments






Share
URL:
You can use this HTML code to put it on your website to show your friends this wallpaper. Use this code on your profile like myspace, friendster, Facebook or others. Just Copy and Paste it in your HTML on your websites



Fourms BBCODE:
BBCODE is use on forums. You can put this code on all your BBCODE enabled forums like PhpBB, vBulletin® and others. Just Copy and Paste this code on your Posts and Replies on your forums





Comments and replies About How To Display Array Contents




:: 1 :: Reply #40745 Reply By lucas On Mon Feb 11, 2008 2:23 pm
lets say you have something like this:

<?php
$array = array("size" => "XL", "color" => "gold");
echo '<pre>';
print_r(array_values($array));
echo '</pre>';
?>


you will have something like this come out:
OUTPUT:
Array
(
    [0] => XL
    [1] => gold
)
:: 2 :: Reply #40748 Reply By hostman On Mon Feb 11, 2008 2:27 pm
thanks..

you can get more information at

http://www.php.net/manual/en/function.array-values.php
:: 3 :: Reply #42790 Reply By tech support On Sat Feb 23, 2008 6:15 pm
if you want display from mysql query you can us this one:


$sql = "SELECT * FROM ".$db_prefix."config";
$result = mysql_query($sql ,$db);
$myrow = mysql_fetch_array($result);
print_r(array_values($myrow));
:: 4 :: Reply #42917 Reply By Administrator On Sun Feb 24, 2008 12:10 pm
take a look at this tutorial. it helped me alot

how-to-index-arrays-and-show-all-the-elements-and-values-of-array