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'], '
'; }

Example 2: using print_r

echo '
'; print_r($up_comming_movies); echo '

';

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

echo "
";
print_r($up_comming_movies);
echo "

";

Results

Array
(
    [0] => a
    [1] => b
    [2] => c
)

Example 3: using json_encode

echo json_encode($up_comming_movies);

using var_dump();

var_dump($movies);

PHP Arrays Example










Example of Displaying the PHP Array Values

";
}
?>

I hope you get an idea about php get array value by key.
I would like to have feedback on my infinityknow.com 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