PHP print_r showing 1 after Array Result

Author: Zeeshan Arshad     1490     02/13/2013

Estimated reading time: 0 minutes, 25 seconds

Zeeshan Arshad - Lifestyle Blog

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




[0] => Science
[1] => Math


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 :)

« Return to Blog