compare version using PHP_VERSION_ID

This continues the work started in #12497 on the `2.3` branch.