>>> And if necessary, we can convert them to native arrays: >>> >>> if( $arrayable instanceof \Arrayable ) { >>> $arrayable = $arrayable->toArray(); >>> } >> >> Also the toArray() should be called when an Arrayable is cast to an array: >> (array)$arrayable. >> >> And shouldn’t the toArray match the same naming semantics as __toString? > > I proposed a while back adding a new magic method __toArray that > would automatically cast. I'm halfway through writing the RFC (in > draft and unpublished). > > I wonder how that could tie in to this proposal. Or even be a > precursor to this.
Thank you for your very good suggestions! @Steven: Can you please post the URL of your RFC? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php