Skip to content

Scalar Type Casting Magic Methods #14073

@kripper

Description

@kripper

Description

When doing $obj + 123, $obj shouldn't be treated by PHP as a string when $obj is a numeric representation.
Adding the magic casting method __toscalar is handy for solving this.

Please release this patch.
See: https://wiki.php.net/rfc/object_cast_to_types

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions