Time of Update: 2017-01-13
max() 返回最大值。文法max(x,y)參數 描述 x 必需。一個數。 y 必需。一個數。說明max() 返回參數中數值最大的值。如果僅有一個參數且為數組,max() 返回該數組中最大的值。如果第一個參數是整數、字串或浮點數,則至少需要兩個參數而 max() 會返回這些值中最大的一個。可以比較無限多個值。echo max(1,3,5,6,7); //返回7echo
Time of Update: 2017-01-13
file_get_contents() 函數把整個檔案讀入一個字串中。和 file() 一樣,不同的是 file_get_contents() 把檔案讀入一個字串。file_get_contents()
Time of Update: 2017-01-13
$values=array( 40,50, //第一個頂點的座標 20,240, //第一個頂點的座標
Time of Update: 2017-01-13
image_type=image_type_to_mime_type(imagetype_png); //擷取png的mime類型echo $image_type; //輸出結果//$file = '1.jpg';$image = imagecreatefromjpeg($file);header('content-type: ' .
Time of Update: 2017-01-13
代碼擴充擷取遠程主機socket資訊*/function getpeername(){ $remote_ip=$remote_port=0; //定義ip socket_getpeername($this->fd,$remote_ip,$remote_port); //返回主機資訊 return
Time of Update: 2017-01-13
文法opendir(path,context)*/$d=dir("c:windows"); //開啟目錄,並賦值給變數echo "handle:".$d->handle."n"; //輸出目錄的handel屬性echo "&
Time of Update: 2017-01-13
一,擷取指定日期的unix時間戳記 strtotime("2009-1-22") 樣本如下: 1.echo strtotime("2009-1-22")結果:1232553600 說明:返回2009年1月22日0點0分0秒時間戳記 二,擷取英文文本日期時間 樣本如下: 便於比較,使用date將當時間戳記與指定時間戳記轉換成系統時間 (1)列印明天此時的時間戳記strtotime("+1 day") 目前時間: 1.echo date(&
Time of Update: 2017-01-13
strpos() 函數返回字串在另一個字串中第一次出現的位置。如果沒有找到該字串,則返回 false。文法strpos(string,find,start)*/$str="hello
Time of Update: 2017-01-13
substr_compare() 函數從指定的開始長度比較兩個字串。該函數返回:0 - 如果兩字串相等 <0 - 如果 string1 (從開始位置)小於 string2 >0 - 如果 string1 (從開始位置)大於 string2 文法substr_compare(string1,string2,startpos,length,case)*/$str1="hello
Time of Update: 2017-01-13
parse_str()函數可實現把字串解析到變數中,這意味著實現了字串與變數之間的一種轉換機制,在與用戶端資料傳遞的過程中,資料是通過字串的形式傳遞,如GET請求,然後在伺服器端通過$_GET/$_POST等全域變數實現字串與變數的轉換,如:http://www.liuhui.info/?index.php?var1=1&var2=2,請求後服務端可使用$_GET['var1']的方式擷取var1=1&var2=2這一段字串轉換成變數。parse_str()函數可實現用樣的功能,
Time of Update: 2017-01-13
代碼如下複製代碼 <?phpfunction deleteFromArray(&$array, $deleteIt, $useOldKeys = FALSE){ $key = array_search($deleteIt,$array,TRUE); if($key === FALSE) return
Time of Update: 2017-01-13
//參數'a..z'界定所有大小寫字母均被轉義echo addcslashes('foo[ ]','a..z'); //輸出:foo[ ]//$str="is your name o'reilly?"; //定義字串,其中包括需要轉義的字元echo
Time of Update: 2017-01-13
代碼如下複製代碼 <?php //構造字串 $str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; echo "原字串:<b>".$str."</b><br>"; //按各種方式進行截取 $str1 = substr($str,5); echo
Time of Update: 2017-01-13
定義和用法mysql教程_field_type() 函數返回結果集中指定欄位的類型。如果成功,則返回指定欄位的類型,如果失敗,則返回 false。文法mysql_field_type(data,field_offset)參數 描述 data 必需。要使用的資料指標。該資料指標是從 mysql_query() 返回的結果。 field_offset 必需。指示從哪個欄位開始返回。0
Time of Update: 2017-01-13
php教程 explode() 函數php string 函數定義和用法explode() 函數把字串分割為數組。文法explode(separator,string,limit)參數 描述 separator 必需。規定在哪裡分割字串。 string 必需。要分割的字串。 limit 可選。規定所返回的數組元素的最大數目。例子在本例中,我們將把字串分割為數組: 代碼如下複製代碼 <?php$str = "hello world. it's a
Time of Update: 2017-01-13
php教程 ereg()把htm轉換成xml檔案實現方法文法: int ereg(string pattern, string string, array [regs]);傳回值: 整數/數組 <?php$text = "<p>This is some text here "</p>".</p>"; ereg("<p>(([^<"]|[^<]*<[^/][
Time of Update: 2017-01-13
php教程 自定字串中的部分字元進行替換方法substr_replace()函數對自定字串中的部分字元進行替換 文法:substr_replace(str,repl,start,[int length]) 文法說明: str——必選參數,指定要操作的原始字串 repl——指定替換後的新字串
Time of Update: 2017-01-13
一般最簡單就是字元替換了如:str_replace("#", "-", "dizaz#7#final"),更進階的就是儲存資料替換了。str_replace(array('#', '$'), "-", "dizaz#7$final") 等,就這些調用方式,其它這些方法在php教程中最非常簡單的,還有就是數組替換資料str_repace( array(1,2,3,4,5),'',array(6,7,
Time of Update: 2017-01-13
非負浮點數(正浮點數 + 0):^d+(.d+)?$正浮點數 ^(([0-9]+.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*.[0-9]+)|([0-9]*[1-9][0-9]*))$非正浮點數(負浮點數 + 0) ^((-d+(.d+)?)|(0+(.0+)?))$負浮點數 ^(-(([0-9]+.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*.[0-9]+)|([0-9]*[1-9][0-9]*)
Time of Update: 2017-01-13
filter_validate_float 過濾器把值作為浮點數來驗證。*/$var=12.3;var_dump(filter_var($var, filter_validate_float));//float(12.3)/*非負浮點數(正浮點數 + 0):^d+(.d+)?$正浮點數 ^(([0-9]+.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*.[0-9]+)|([0-9]*[1-9][0-9]*))$非正浮點數(負浮點數 + 0) ^