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 Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or 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

Add a Patch

Pull Requests

Add a Pull Request

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-2021 The PHP Group
All rights reserved.
Last updated: Sat Sep 25 21:03:35 2021 UTC