關於PHP函式的操作

2022-08-13 03:09:20 字數 640 閱讀 3094

<?php

//簡單函式

function show()

show();

//有引數的函式

function show($a)

show("world");

//有返回值的函式

function show()

echo show();

function show($a,$b)

echo show(10,5);

//可變引數的函式(特殊用法)

function sum()匹配n次 至少出現n次最多不限 至少n次最多m次

x|y 或的意思  [abc]匹配其中任意乙個 [a-z]匹配a到z之間的任意乙個

\d任意乙個數字  \s任何可見字元 \w包括下劃線的任意單詞字元

$s = a1b2c3d4e5;

echo preg_replace("/\d/","*",$s);//替換

var_dump(preg_split("/\d/",$s));//拆分

//匹配第乙個滿足正則的型別

$s = file_get_contets();//獲取內容

$arr = array();

preg_match("",$s,$arr);

?>

php關於檔案內容的幾個操作函式總結

licfile content file get contents var www html files tmp file name 獲取某乙個路徑下的檔案內並賦值給變數 licfile content,此時該變數內容為字串 file put contents var www html files ...

php操作函式

array keys array 返回所有鍵名 array values array 返回所有鍵值 result array reverse input 將陣列顛倒,不保留鍵名 result keyed array reverse input,true 將陣列顛倒,保留鍵名 array keys a...

關於PHP的isset 函式

1 doctype html 2 html 3 head 4 title title 5 meta charset utf 8 6head 7 body 8 form action method get 9 select name select option html語法 10 option val...