Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有一个像这样的点形式的字符串:1.1.3
1.1.3
我想substring从一开始就得到这个字符串,直到最后一个“。”的位置。- 1,即1.1。
substring
1.1
如何做到这一点?
$versionstring = "1.1.3"; echo substr($versionstring,0,strrpos($versionstring,"."));
mb_substr($string,0,strpos($string, "."));