Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112916 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 16835 invoked from network); 17 Jan 2021 17:53:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jan 2021 17:53:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2D470180538 for ; Sun, 17 Jan 2021 09:33:12 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 17 Jan 2021 09:33:11 -0800 (PST) Received: by mail-ej1-f42.google.com with SMTP id l9so14734776ejx.3 for ; Sun, 17 Jan 2021 09:33:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=r6f2tZH7xFu4mlOLseLxXRo01kRQdse2gJuPT5nw6lk=; b=rukORu4hqT+jVXQsXE6+h1mfwV/6cIX7YAGcQzZsI+c3wyY25sChxM3IE9wUk/HrIt jBGWxw0Q1SnFmDCfMdYF+1hK5tDoT3VpZ76OGc0WKscvzkYRLhHiS4cWjs5gaabcmOGu R4fEjyBlCAoOXU8nqcikuWlOHLoTGXFDOr7UH8j1J97cOYyr/PPq0r3g5Y9f4PSREv0b URVstT2fUFyt5Jwb9v19/0KCOBRrTPUni4a3FWU6zEfS15ZCFrJz/DpJii8M8ff9asrz V1Lo5QUuJqudszP/9pi6oofOYS2lWhQf9BvbjbRc6bJ8q54WL/7yZzTxI07JAb+z/U53 bdzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=r6f2tZH7xFu4mlOLseLxXRo01kRQdse2gJuPT5nw6lk=; b=a3WTNbdwjg/YbeN8b8QnL9/AhAE+da2yiTRXQiulQPuQV2nql79t7CYQVXWry8QQ3i SsEr8+ckhuwiy4939leC3UzsVQal+VfLZzskGfE3LWpuR5o1blwPUAXWtBXPK1dGJJdw //fy/nzk9kGnLJnSfNzI7KUF6aC5DB1Ca6d7sp8ATFghPjsi8IHhXRWXRSJ5Pc3z3nKi YD0Bd4vgLjfFdqHJa6ixnD7aeZYHSPQoHKGQRi6ulaVNjORJFICVVXp7+V7C/BnIikNm HGP4Kxg1YkQxvhC27aWKILJwDWdOQelEil9QxdgFN31O1r9IeBUE7e/AhZpLDwUch37H GVfQ== X-Gm-Message-State: AOAM532adKHmKKb61zTxXWRPsLnV3HCAvLCUmIaoBoie4O/6d43FPtuL hSoxC5UBpoUoRE+g21W0D2XtXR+Ic4FqMuYaTmA= X-Google-Smtp-Source: ABdhPJyxxcP73DQ/rKMxKywAmaiCsTH0Uz8K2Obu6dQQRPakJvkKO/bF/bkL/ETxblmjrzFJSKTpjhCdFPUKPyapcfQ= X-Received: by 2002:a17:906:278b:: with SMTP id j11mr1278982ejc.438.1610904789743; Sun, 17 Jan 2021 09:33:09 -0800 (PST) MIME-Version: 1.0 References: <85650FC3-F510-4837-8D21-875288EC1EF1@gmail.com> In-Reply-To: <85650FC3-F510-4837-8D21-875288EC1EF1@gmail.com> Date: Sun, 17 Jan 2021 17:32:58 +0000 Message-ID: To: Claude Pache Cc: tyson andre , PHP internals Content-Type: multipart/alternative; boundary="000000000000c27c6905b91bff38" Subject: Re: [PHP-DEV] Proposal: Render floats differently from integers in print_r() From: tekiela246@gmail.com (Kamil Tekiela) --000000000000c27c6905b91bff38 Content-Type: text/plain; charset="UTF-8" Hi Tyson, I was taught in school that trailing zeros and the decimal point can be omitted when writing a number. It reads much better when you don't have to see all the zeroes following the decimal point. When humans write a number that has no digits after the decimal point they don't write the decimal point. `print_r` is designed to print the data in a human-readable format. There should be no information about the variable type. If you would like to see the data together with the type then you can use `var_dump`. If you want to see the data exactly as it is stored internally then use `var_export`. `print_r` is meant to display the data recursively in a friendly way. Adding the unnecessary decimal point is against that. On a technical note. `print_r` and `print` display data after casting it to a string. The way PHP is currently designed is that when you cast 1.0 to a string it becomes "1". Same with boolean TRUE. If you want to change the way that floats and booleans are represented as strings then you would have to change the way that the cast to string works. This would be a major change. Kind Regards, Kamil --000000000000c27c6905b91bff38--