Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing an array..

Status
Not open for further replies.

Thomas001

Programmer
Jun 24, 2004
29
US
Does anyone know a good way I can print out an entire array?

All I know is that it would probably require a loop of some sort.


Thanks :)
 
You have a built-in function in php. Print recursive or print_r:
Code:
<?php
echo '<pre>';
print_r($array);
echo '</pre>';
?>
Pre tags are for easier reading.
 
Yup. Loop it up.

Code:
$stuffArray[0] = "some stuff";
$stuffArray[1] = "other stuff";
$stuffArray[2] = "last stuff";

foreach ($stuffArray as $stuffItem) {
    echo $stuffItem . "<br>\n";
}

*cLFlaVA
----------------------------
A polar bear walks into a bar and says, "Can I have a ... beer?"
The bartender asks, "What's with the big pause?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top