how to display array values in php

Today, We want to share with you how to display array values in php.In this post we will show you php echo array values foreach, hear for php get all values from multidimensional array we will give you demo and example for implement.In this post, we will learn about How to Print Arrays in PHP? with an example.

Display array values in PHP

Example 1: foreach loop in php

foreach($array as $key => $value)
{
  echo $key." has the value". $value;
}

consider using implode

$string=implode(",",$array);
echo $string;

//or

$withComma = implode(",", $array);

echo $withComma;
// Will display mobile,laptop,camero

Pre code

'mobile','b'=>'laptop','c'=>'camero');?>

How to echo or print an array in PHP?

Use the PHP foreach loop

";
}
?>

I hope you get an idea about How to print or echo all the values of an array in PHP?.
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