Four PHP Application Small Functions

zhaozj2021-02-11  217

First, how to check the variable content php4 has a var_dump ($ var) function, used to Dump one variable content (various types of variables), just the output of this function is not suitable in the HTML page. You can write a function yourself as follows: Function Dump ($ var) {echo "

 / n"; var_dump ($ var); echo " / n";} is very suitable for debugging! In PHP3, you can only use the recursive method DUMP out of an Array content, and it is powerless for Object. It seems that the last Dump_Array function is such a function. :) Second, static variables  Three, avoid the same celebrity A method of multiple times # ---------------- Avoid The Same Name ------------- for ($ Checkname = 0; $ Checkname <$ Num; $ Checkname    {IF ($ Name [$ Checkname] == $ Name [$ Num]) {$ Num--; Break;}} 4, get a file extension is used to use this small function: Function FileExtName ($ fileEname) {$ RETVAL = ""; $ Pt = Strpos ($ filename, "."); if ($ pt) $ RETVAL = Substr ($ FileName, $ PT   1, Strlen ($ filename) - $ PT); Return ($ RETVAL);

}

转载请注明原文地址:https://www.9cbs.com/read-5002.html

New Post(0)