Req #81609 [Com]: NO string casting/comparison WITH strict_types=1
| From: | georgtr6574 at gmail dot com | Date: | Mon, 31 Jul 2023 10:35:31 +0000 |
| Subject: | Req #81609 [Com]: NO string casting/comparison WITH strict_types=1 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-245074@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
Comment by: georgtr6574 at gmail dot com
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:
Here information is given by you is too great it is very help for me thank you for this.
(https://github.com.php)(https://www.myjdfaccount.net/)
Previous Comments:
------------------------------------------------------------------------
[2021-11-13 00:55:56] gib-o-master at mail dot ru
i'll try
------------------------------------------------------------------------
[2021-11-11 10:31:11] cmb@php.net
That change would certainly require the RFC process[1]. Maybe you
want to pursue it?
[1] <https://wiki.php.net/rfc/howto>
------------------------------------------------------------------------
[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