On Wednesday, 9 July 2025 at 22:26, Claude Pache <claude.pa...@gmail.com> wrote:
> Hi, > > A possible reason for wanting to use the non-canonical names in settype(), is > that those names are returned by gettype(). Fictional example (not intended > to be reasonable, only illustrative): > > ```php > function settype_from(&$a, &b) { > return settype($a, gettype($b)); > } > ``` > > Personally, I have used "integer", etc. instead of "int", etc., in settype() > in the past, because those were the “canonical” (as I perceived) forms > returned by gettype(). I have slowly fallen out of that habit in the years > after I began to use scalar type declarations (introduced in PHP 7). We are well aware of this "issue" and get_debug_type() was introduced in PHP 8 as a replacement for gettype() that returns the canonical names. The one difference is that objects return the class name rather than "object". I can add a deprecation of gettype() to nudge people to use get_debug_type() instead, if you think that's reasonable. Best regards, Gina P. Banyard