What about [`version_compare`](https://php.net/manual/en/function.version-compare.php) in PHP ?

```sh
php -r "var_dump(version_compare('1.0.0-pre', '1.0.1'));"
int(-1)

php -r "var_dump(version_compare('1.0.2-pre', '1.0.1'));"
int(1)
```