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.
我想在 - 之前剥离字符串中的所有内容,然后留下之后的内容。例如:
15.11-101
我想剥离 15.11 并留下 101。我尝试了一些不同的方法,但似乎无法使其正常工作,如果有人可以帮助我,那就太好了 :)
干杯
莉安娜
你可以使用这样的东西:
$result = substr($original, strpos($original, '-') + 1);
假设它只出现一次,您可以使用explode功能。
$s='15.11-101'; $a=explode('-',$s,1); echo $a[1];
这应该是最快的方法。