How to print array in php?

#15
189
1 Answer
Question Image

I want to print array using pre tag in php, how can i do it?

my arrays are !

$array = array('red', 'pink', 'blue', 'white');

Sir please tel me how I print as array


Related to:
phparrayprint_rpre
0
Answer
Answer 1 of 1
# 1

You can print array as:

1. print_r($array);

2. Using <pre> tag as echo '<pre>'; print_r($array); echo '</pre>';

3.  var_dump($array); Using for get mata information about array such as data tipe length and other

4. You can loop the array using php's foreach(); function get the desired output.

0
0
0
Related Articles

If you still have a question about this, submit it in our Q&A community - Ask Question