PHP print Array using print_r() Example

Today, We want to share with you PHP print Array using print_r() Example.In this post we will show you PHP Simple print_r() function with Example, hear for How to Display Array Structure and Values in PHP we will give you demo and example for implement.In this post, we will learn about print associative array in php with an example.

PHP print Array using print_r() Example

There are the Following The simple About PHP print Array using print_r() Example Full Information With Example and source code.

Read Also:  PHP download file from url using curl example

As I will cover this Post with live Working example to develop PHP Array: Associative, Multidimensional, so the print associative array in php for this example is following below.

An array in PHP computer programming Data contains a total group of main data objects that are the same data type and data size. The PHP array can data main integers datatypes, characters as well as anything else with a main defined PHP data type.

Read Also:  How to Print Arrays in PHP?

How to Define and Print a PHP Print Array

$product_array = array(10,102,6,1920,50,102,2);
echo "<pre>";
echo "</pre>";

[0] => 10
[1] => 102
[2] => 6
[3] => 1920
[4] => 50
[5] => 102
[6] => 2

Output Data

echo "<pre>";print_r($product_array);echo "</pre>";

Output – php array

echo "<pre>".print_r($product_array,true)."</pre>";

Print_r() PHP Function

$Names = array ('a' => 'Atmiya', 'b' => 'jaydeep', 'c' => array ('Cade', 'Laptop'));
print_r ($Names);

When the code is run, the results looks like this:

[a] => Atmiya
[b] => jaydeep
[c] => Array
     [0] => Cade
     [1] => Laptop

Angular 6 CRUD Operations Application Tutorials

Read :

Read Also:  jQuery Ajax File Upload with Progress Bar


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP print Array using print_r() Example.
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.

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  PHP - Array Functions Example With Demo
  2. Read Also:  PHP String Explode and Implode Function
  3. Read Also:  Simple Print PHP Hello World program From scratch
  4. Read Also:  How to declare a global variable in Laravel 5.8?
  5. Read Also:  Laravel 7/6 disable registration example
  6. Read Also:  PHP Array Length Size Count Tutorial With Example
  7. Read Also:  how to display array values in php
  8. Read Also:  Laravel Eloquent query where exists MySQL
  9. Read Also:  Multiple File Upload in laravel 7 Example Tutorial
  10. Read Also:  Create array in laravel 5