original php implementation https://github.com/php/php-src/blob/master/Zend/zend_operators.c#L110