Here are all changes needed to make it work with PHP 7. https://github.com/cataphract/php-discount/compare/master...m6w6:phpng