How to print or echo all the values of an array in PHP?

Today, We want to share with you echo array in php.In this post we will show you associative array in php, hear for php multidimensional array we will give you demo and example for implement.In this post, we will learn about PHP Arrays Example Tutorial For Beginners From Scratch with an example.

How to echo or print an array in PHP?

Also You can use print_r, var_dump and var_export funcations of php:

Example 1: using foreach

foreach($up_comming_movies['data'] as $result) {
    echo $result['type'], '<br>';

Example 2: using print_r

echo '<pre>'; print_r($up_comming_movies); echo '</pre>';

$up_comming_movies = ["a", "b", "c"];

echo "<pre>";
echo "</pre>";


    [0] => a
    [1] => b
    [2] => c

Example 3: using json_encode

echo json_encode($up_comming_movies);

using var_dump();


PHP Arrays Example

<!DOCTYPE html>

$movies = array("TamilRokers", "bolly4u", "4cgandhi"); 
echo "I like " . $movies[0] . ", " . $movies[1] . " and " . $movies[2] . ".";


Example of Displaying the PHP Array Values

$up_comming_movies = array("TamilRokers", "bolly4u", "4cgandhi", "Khatrimaza", "movimaza");
// Loop through up_comming_movies array
foreach($up_comming_movies as $value){
    echo $value . "<br>";

I hope you get an idea about php get array value by key.
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.

Also Read This 👉   stripe payment gateway integration in codeigniter