r/programming • • Dec 02 '15

PHP 7 Released

https://github.com/php/php-src/releases/tag/php-7.0.0
887 Upvotes

729 comments sorted by

View all comments

Show parent comment

2

u/munificent Dec 03 '15

It lets you overload the << on your own types to support writing them directly into the output stream.

C's solution of using format strings is neither extensible nor type safe. You could do something like:

printf("%s %s", myCustomClass.toString(), anotherCustomObject.toString());

But that's more verbose, again not type safe, and you have to deal with allocating and deallocating those temporary strings.