PHP substr
PHP の substr 関数の日本語マニュアルに間違いを見つけた。
人の細かい間違いを指摘するのが大好きなので指摘します。というログ。
string substr ( string string, int start, int [length] )
PHP: substr - Manual 日本語版。たぶん間違い。
length が指定され、かつ負である場合、返さ れる文字列は start の後ろから数えて length 文字までとなります。この指定により 切り出す文字列の長さが負となる場合、start の位置にある1文字のみが文字列として返されます。
正しくは多分こう。
length が指定され、かつ負である場合、返さ れる文字列は string の後ろから数えて length 文字までとなります。この指定により 切り出す文字列の長さが負となる場合、start の位置にある1文字のみが文字列として返されます。
PHP: substr - Manual 英語版。正しい。
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.
substr( "ZabcZ", 1, -1 ) == "abc" になります。
おしまい。
カテゴリ
developmentトラックバック(0)
このブログ記事を参照しているブログ一覧: PHP substr
このブログ記事に対するトラックバックURL: http://je-pu-pu.jp/blog/mt-tb.cgi/482

コメントする