php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14669 print_r inconsistancy with newlines
Submitted: 2001-12-23 08:25 UTC Modified: 2002-07-07 13:01 UTC
From: sander@php.net Assigned:
Status: Wont fix Package: Variables related
PHP Version: 4.1.0 OS: Debian Linux, Win2K
Private report: No CVE-ID: None
 [2001-12-23 08:25 UTC] sander@php.net
print_r ends with a newline if you print_r() an array, but not if you print_r() a string or number:

$foo="abc";
$bar=123;
echo "-";
print_r($foo);
echo "-";
print_r($bar);
echo "-";

Ouput: -abc-123-


$foo=array(123, "abc");
echo "-";
print_r($foo);
echo "-";

Output: 
-Array
(
    [0] => 123
    [1] => abc
)
-

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-07 13:01 UTC] derick@php.net
print_r is a debugging tool, and I don't see any reason why this behavior should bother anybody. Changing status to "Won't fix".

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 11 22:01:27 2024 UTC