How to Print Arrays in PHP?

Today, We want to share with you print array in php.In this post we will show you array to string php, hear for php echo array values foreach we will give you demo and example for implement.In this post, we will learn about Dd And Dump – Dd() Vs Var_dump() Vs Print_r()
with an example.

Echo or Print an Array in PHP


print_r(variable, isStore)

Example 1: readable way by using html


 "", "1" => "is", "2" => "a", "3" => "good",
"4" => "tutorial", "5" => "blog", "6" => "site");

$results = print_r($upcomming_movies_website,true);

echo "
echo $results;
echo "



Example 2:

 "", "type" => "upcomming movies site","content" =>

//print the structure of the array


print array in php

Example 1:

$upcomming_movies_website = array ('a' => 'Tamilrokers', 'b' => 'khatrimaza', 'c' => array ('x', 'y', 'z'));
print_r ($upcomming_movies_website);

Example 2:

 'Tamilrokers', 'b' => 'khatrimaza', 'c' => array ('x', 'y', 'z'));
print_r ($upcomming_movies_website);

Example 3:

Example 4:

foreach($results as $result) {
	echo $result . '
'; }

I hope you get an idea about php foreach ($array).
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment