相关疑难解决方法(0)

比较PHP中的两个版本字符串

如何比较版本格式的两个字符串?这样:

version_compare("2.5.1",  "2.5.2") => -1 (smaller)
version_compare("2.5.2",  "2.5.2") =>  0 (equal)
version_compare("2.5.5",  "2.5.2") =>  1 (bigger)
version_compare("2.5.11", "2.5.2") =>  1 (bigger, eleven is bigger than two)
Run Code Online (Sandbox Code Playgroud)

php

17
推荐指数
2
解决办法
2万
查看次数

标签 统计

php ×1