Req #81609 [Opn]: NO string casting/comparison WITH strict_types=1

From: Date: Thu, 11 Nov 2021 10:31:11 +0000
Subject: Req #81609 [Opn]: NO string casting/comparison WITH strict_types=1
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237685@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81609&edit=1 ID: 81609 Updated by: cmb@php.net Reported by: gib-o-master at mail dot ru Summary: NO string casting/comparison WITH strict_types=1 Status: Open Type: Feature/Change Request Package: *General Issues PHP Version: Irrelevant Block user comment: N Private report: N New Comment: That change would certainly require the RFC process[1]. Maybe you want to pursue it? [1] <https://wiki.php.net/rfc/howto> Previous Comments: ------------------------------------------------------------------------ [2021-11-11 04:13:30] gib-o-master at mail dot ru Description: ------------ if there is a declare(strict_types=1); string to number casting should be avoided, for example: var_dump('20' < '3');// is false Pros/Cons: + it will be faster (no if string is a number check, no casting) + it will be common (with strings, compat with other langs like JS, Python) + it will be more error prone (because it's common) - some old code which rely on this feature will break (does it exist?) Test script: --------------- var_dump('20' < '3'); Expected result: ---------------- true Actual result: -------------- false ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81609&edit=1

« previous php.bugs (#237685) next »