PHP代码
- <?php
- $rest = substr("abcdef", 1); // returns "bcdef"
- echo substr("abcdef", 1) returns . $rest . "<br>";
- $rest = substr("abcdef", 1, 3); // returns "bcd"
- echo substr("abcdef", 1, 3) returns . $rest . "<br>";
- $rest = substr("abcdef", -1); // returns "f"
- echo substr("abcdef", -1) returns . $rest . "<br>";
- $rest = substr("abcdef", -2); // returns "ef"
- echo substr("abcdef", -2) returns . $rest . "<br>";
- $rest = substr("abcdef", -3, 1); // returns "d"
- echo substr("abcdef", -3, 1) returns . $rest . "<br>";
- $rest = substr("abcdef", 1, -1); // returns "bcde"
- echo substr("abcdef", 1, -1) returns . $rest . "<br>";
- ?>