Re: Proposal: Render floats differently from integers in print_r()
| From: | Claude Pache | Date: | Sun, 17 Jan 2021 17:02:53 +0000 |
| Subject: | Re: Proposal: Render floats differently from integers in print_r() | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112915@lists.php.net to get a copy of this message | ||
> Le 17 janv. 2021 à 16:58, tyson andre <tysonandre775@hotmail.com> a écrit :
>
> Hi internals,
>
> Currently, print_r() will print ints and floats in exactly the same way, despite the fact that
> they are different types
> and floats may cause a TypeError (or be treated differently from integers, e.g. avro encoding)
> when used where an integer is expected.
> This is not documented in https://www.php.net/print_r
This is the same behaviour as
print (and asecho). Note also that there is
also no distinction for print/print_r in rendering the string
"1", the integer 1, and the booleantrue. I think that the original intention
of print_r was to have a “recursive” version of print.
If some action is to be taken, I suggest to deprecate print_r.
—Claude