Traditionnally, PHP extensions contain C code only. The main reason is
obvious : this code needs to be fast and access external C APIs. But, in many
cases, some parts of the extension code could be written in PHP.

!!! Feature implemented in PHP 7.2.0 !!!

Today, PHP extensions are loaded using their file names. Unfortunately, this
filename depends on the operating system. So, when they want to activate an
extension, newcomers are confused about the exact directive they must add to the
php.ini file. The php.ini comments are also very confusing, using the word
'extension' as a synonym for 'file suffix' and providing examples using the
windows syntax only.

The __toString() magic method allows to convert an object to a string. This mechanism can be extended to allow converting
to other scalar types. New rules can also allow converting the value, even when
the specific method is not implemented.