Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision |
rfc:object_cast_to_types [2012/03/04 01:23] – [Handler Behavior] ircmaxell | rfc:object_cast_to_types [2012/03/04 01:24] – [Syntax] ircmaxell |
---|
This RFC and patch introduces 4 new magic methods: | This RFC and patch introduces 4 new magic methods: |
| |
* ''__toInt()'' - Called when casting an object explicitly to an integer (or passing it to an internal function which expects an integer) | * ''_ _toInt()'' - Called when casting an object explicitly to an integer (or passing it to an internal function which expects an integer) |
* ''__toFloat()'' - Called when casting an object explicitly to a float (or passing it to an internal function which expects a float) | * ''_ _toFloat()'' - Called when casting an object explicitly to a float (or passing it to an internal function which expects a float) |
* ''__toArray()'' - Called when casting an object explicitly to an array (or passing it to an internal function which expects an array) | * ''_ _toArray()'' - Called when casting an object explicitly to an array (or passing it to an internal function which expects an array) |
* ''__toScalar()'' - Called when using an object in an implicit scalar scope without type information (for example: ''$obj + 1''). | * ''_ _toScalar()'' - Called when using an object in an implicit scalar scope without type information (for example: ''$obj + 1''). |
| |
==== Handler Behavior ==== | ==== Handler Behavior ==== |