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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 08:01:28 2024 UTC