Re: Change output of gettype?
| From: | Pierre | Date: | Mon, 01 Dec 2025 20:55:31 +0000 |
| Subject: | Re: Change output of gettype? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129488@lists.php.net to get a copy of this message | ||
Le 01/12/2025 à 21:12, BohwaZ a écrit :
Hi all, PHP 8.5 has deprecated the following type names: - integer - double - boolean - binary But the gettype() function still returns integer, double and boolean instead of int, float and bool. This inconsistency is quite confusing for new developers (and even older ones). I understand that changing the return of gettype might break a lot of existing code, so maybe it's not a good idea (yet).And if I remember correctly, that's exactly why get_debug_type() was introduced: no BC break, and it does the job. You should simply use get_debug_type() everywhere and never use gettype() ever again. This is the most sensible move you can make, it really is the function you should use in most case. -- Pierre