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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sander@php.net
New email:
PHP Version: OS:

 

 [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: Sat Dec 21 11:01:30 2024 UTC