我用 5.2.3 <? echo substr('111',-6) === false; ?> substr的结果是返回 false 手册里是这么写的,看来直到5.2.2才真正实现 http://cn.php.net/substr----------------------------If length is given and is positive, the string returned will contain at most length characters beginning from start (depending on the length of string). If string is 【less than or equal to start characters long】, 【FALSE】 will be returned. If length is given and is negative, then that many characters will be omitted from the end of string (after the start position has been calculated when a start is negative). If start denotes a position beyond this truncation, an empty string will be returned. 例 2292. Using a negative length<?php $rest = substr("abcdef", 0, -1); // returns "abcde" $rest = substr("abcdef", 2, -1); // returns "cde" $rest = substr("abcdef", 4, -4); // returns "" $rest = substr("abcdef", -3, -1); // returns "de" ?>
<?
echo substr('111',-6) === false;
?>
substr的结果是返回 false 手册里是这么写的,看来直到5.2.2才真正实现
http://cn.php.net/substr----------------------------If length is given and is positive, the string returned will contain at most length characters beginning from start (depending on the length of string). If string is 【less than or equal to start characters long】, 【FALSE】 will be returned. If length is given and is negative, then that many characters will be omitted from the end of string (after the start position has been calculated when a start is negative). If start denotes a position beyond this truncation, an empty string will be returned. 例 2292. Using a negative length<?php
$rest = substr("abcdef", 0, -1); // returns "abcde"
$rest = substr("abcdef", 2, -1); // returns "cde"
$rest = substr("abcdef", 4, -4); // returns ""
$rest = substr("abcdef", -3, -1); // returns "de"
?>
手册上说的是 返回 false的。。
111