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.
如果您有以下字符串:
$something = 'abcdefg'; $cut = substr( $something, 0, -2);
结果:abcde
有没有办法将切割的部分存储到一个新的变量中,所以在这个例子中,在删除它们之前保存“fg”?
$something = 'abcdefg'; $cut = substr( $something, 0, -2); // abcde $endBit = substr($something, -2); // fg
查看手册了解所有血腥细节:substr