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.

Also Read :  Laravel Vuejs Ajax Validation Tutorial With Example

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:

Also Read :  Vuejs color picker Plugins With Examples

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.

Gondaliya Jaydeep

Hi, I’m Jaydeep Gondaliya, PHP developer.Pakainfo.com is the most popular Programming & Web Development blog. Our mission is to provide the best online resources on programming and web development.Any visitors of this site are free to browse our tutorials, live demos, Examples and download scripts.If you have a project that you want to get started, launch quickly, contact me. Email : [email protected]