国产chinesehdxxxx野外,国产av无码专区亚洲av琪琪,播放男人添女人下边视频,成人国产精品一区二区免费看,chinese丰满人妻videos

PHP strcspn() 函數

2018-11-21 14:50 更新

PHP strcspn() 函數

PHP String 參考手冊 PHP String 參考手冊

實例

輸出在字符串 "Hello world!" 中找到字符 "w" 之前查找的字符數:

<?php
echo strcspn("Hello world!","w");
?>

運行實例 ?

定義和用法

strcspn() 函數返回在找到任何指定的字符之前,在字符串查找的字符數(包括空格)。

提示: Use the strspn() function to the number of characters found in the string that contains only characters from a specified character list.

注釋: This function is binary-safe.


語法

strcspn(string,char,start,length)

參數 描述
string 必需。規(guī)定要搜索的字符串。
char 必需。規(guī)定要查找的字符。
start 可選。規(guī)定開始查找的位置。
length 可選。規(guī)定字符串的長度(搜索多少字符)。

技術細節(jié)

返回值: 返回在找到任何指定的字符之前,在字符串查找的字符數。
PHP 版本: 4+
更新日志: 在 PHP 4.3 中,新增了 startlength 參數。


更多實例

實例 1

使用所有的參數來輸出在字符串 "Hello world!" 中找到字符 "w" 之前查找的字符數:

<?php
echo strcspn("Hello world!","w",0,6); // The start position is 0 and the length of the search string is 6.
?>

運行實例 ?


PHP String 參考手冊 PHP String 參考手冊
以上內容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號