Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #14458

Re: Purpose for a str_replace with an embedded print_r return

From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.php
Subject Re: Purpose for a str_replace with an embedded print_r return
Date 2014-11-04 16:08 +0100
Organization solani.org
Message-ID <m3aq5j$hii$1@solani.org> (permalink)
References <bad4f2c1-102e-4115-94ea-c8f8efdaca0b@googlegroups.com>

Show all headers | View raw


Dave Patoch wrote:

> I'm cleaning up a legacy code base and I've been trying to figure out what the
> functional difference (other then a few cpu ticks and a bit of memory) is
> between:
> 
> foreach(
>     explode("\n", str_replace("\r\n", "\n", print_r($message, true))) as $msg)
> 
> and
> 
> foreach(
>     explode("\n", str_replace("\r\n", "\n", $message)) as $msg)
> 
> That first line seems to have been taken from straight from the php-agi 
> library, and after a bunch of experimenting and googling I haven't found any
> real information. My suspicions are that this was a workaround for some bug
> in php 4.x or possibly to force an error if used with ob_start() but I'm
> hoping that someone knows the real purpose for that print_r return.

What type of value does $message hold? If it is an array or an object,
than the print_r definitely makes a difference; otherwise there isn't
any, AFAIK.

-- 
Christoph M. Becker

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Purpose for a str_replace with an embedded print_r return Dave Patoch <earthlydilemma@gmail.com> - 2014-11-04 06:20 -0800
  Re: Purpose for a str_replace with an embedded print_r return "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-11-04 16:08 +0100
    Re: Purpose for a str_replace with an embedded print_r return Dave Patoch <earthlydilemma@gmail.com> - 2014-11-04 07:27 -0800
      Re: Purpose for a str_replace with an embedded print_r return Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-04 16:58 +0100
        Re: Purpose for a str_replace with an embedded print_r return "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-11-04 18:58 +0100
          Re: Purpose for a str_replace with an embedded print_r return Jerry Stuckle <jstucklex@attglobal.net> - 2014-11-04 13:54 -0500
            Re: Purpose for a str_replace with an embedded print_r return Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-05 14:27 +0100
              Re: Purpose for a str_replace with an embedded print_r return Jerry Stuckle <jstucklex@attglobal.net> - 2014-11-05 08:46 -0500
                Re: Purpose for a str_replace with an embedded print_r return Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-05 15:32 +0100
                Re: Purpose for a str_replace with an embedded print_r return Jerry Stuckle <jstucklex@attglobal.net> - 2014-11-05 10:44 -0500
                Re: Purpose for a str_replace with an embedded print_r return Matthew Carter <m@ahungry.com> - 2014-11-05 15:50 -0500
                Re: Purpose for a str_replace with an embedded print_r return Jerry Stuckle <jstucklex@attglobal.net> - 2014-11-05 16:59 -0500
                Re: Purpose for a str_replace with an embedded print_r return "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-11-05 23:56 +0100
                Re: Purpose for a str_replace with an embedded print_r return Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-06 04:30 +0100
                Re: Purpose for a str_replace with an embedded print_r return Jerry Stuckle <jstucklex@attglobal.net> - 2014-11-05 22:53 -0500
  Re: Purpose for a str_replace with an embedded print_r return Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-05 15:07 +0000
    Re: Purpose for a str_replace with an embedded print_r return Jerry Stuckle <jstucklex@attglobal.net> - 2014-11-05 10:47 -0500
      Re: Purpose for a str_replace with an embedded print_r return Matthew Carter <m@ahungry.com> - 2014-11-05 15:51 -0500
        Re: Purpose for a str_replace with an embedded print_r return Jerry Stuckle <jstucklex@attglobal.net> - 2014-11-05 17:00 -0500
          Re: Purpose for a str_replace with an embedded print_r return Matthew Carter <m@ahungry.com> - 2014-11-05 22:35 -0500
            Re: Purpose for a str_replace with an embedded print_r return Jerry Stuckle <jstucklex@attglobal.net> - 2014-11-05 22:55 -0500
            Re: Purpose for a str_replace with an embedded print_r return Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-06 04:26 +0000
              Re: Purpose for a str_replace with an embedded print_r return Matthew Carter <m@ahungry.com> - 2014-11-06 00:09 -0500
                Re: Purpose for a str_replace with an embedded print_r return Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-06 23:59 +0000
            Re: Purpose for a str_replace with an embedded print_r return "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-11-06 18:43 +0100
        Re: Purpose for a str_replace with an embedded print_r return Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-06 02:39 +0000
      Re: Purpose for a str_replace with an embedded print_r return Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-06 02:44 +0000
        Re: Purpose for a str_replace with an embedded print_r return Jerry Stuckle <jstucklex@attglobal.net> - 2014-11-05 22:56 -0500

csiph-web