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.

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.

How to Define and Print a PHP Print Array

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

//Output
Array
(
[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

<pre>
<?php
$Names = array ('a' => 'Atmiya', 'b' => 'jaydeep', 'c' => array ('Cade', 'Laptop'));
print_r ($Names);
?>
 </pre>

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

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

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

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 Pakainfo.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.


Related FAQ

Here are some more FAQ related to this Article:

  1.   PHP String Explode and Implode Function
  2.   jQuery Accordion Vertical Menu using CSS
  3.   Select DropDown Option Selected In Laravel
  4.   Angular 8 Material Table Filter Sorting Paging
  5.   Create array in laravel 5
  6.   PHP Convert multi-dimentional array into single array
  7.   PHP Array Length Size Count Tutorial With Example
  8.   Jquery Get Number of Characters String length
  9.   Angular 9/8 Radio Button on Form Submit
  10.   PHP MySQL Inline Editing Dynamically using jQuery Ajax