PHP print_r showing 1 after Array Result

Author: Zeeshan Arshad     1149     02/13/2013

Estimated reading time: 0 minutes, 25 seconds

Problem: When printing an array, it is displaying 1 at the end of array result.

 

Example:

 

Array
(
[0] => Science
[1] => Math
)
1

 

Solution: Remove the echo before using print_r, you are probably using echo print_r($array);

 

Comment: It is funny and yes I fell into this situation while messing with lots of code of a system. I myself spent too much time to figure it out and had to Google about it. I was then LOL :)


Was this topic helpful?

Yes
No
Subscribe YouTube Channel

Zeeshan Arshad is a self-taught and multi-dimensional person with extraordinary track record of success with international clients and students.

Feel free to contact him for your project, training purpose or guidance.