How To Display Array Contents In Php With A Simple Function

Forums » PHP » How To Display Array Contents In Php With A Simple Function
This Page Contains information about How To Display Array Contents In Php With A Simple Function By mysql in category PHP with 5 Replies. Last Upated: Thu May 15, 2014
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
lucas
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
)
tech
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));
Administrator
take a look at this tutorial. it helped me alot

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

Bhargb
Plz reply me of this problem..................
Title: How To Display Array Contents In Php With A Simple Function [1078]
Tags: how to display array contents
By
Comments 5
Visits 2499