W3docs

How can I print all the values of an array?

In PHP, you can use a foreach loop to iterate through an array and print each value.

In PHP, you can use a foreach loop to iterate through an array and print each value. Here's an example:

Example of foreach loop and printing each value in PHP

php— editable, runs on the server

<div class="alert alert-info flex not-prose"> Watch a course <span class="hidden md:block">Watch a video course </span> Learn object oriented PHP</div>

You can also use print_r or var_dump to print all the values of an array.

Printing all the values of an array with print_r in PHP

php— editable, runs on the server

Printing all the values of an array with var_dump in PHP

php— editable, runs on the server

Both will give you the same result.