1,php_sapi_name ()
Php_sapi_name returns the interface type between the Web server and PHP. Function Description:
String Php_sapi_name (void)
Returns a lowercase string that describes the type of interface used by PHP, such as the CLI PHP under which the string is "CLI", under which Apache may have several different values depending on the SAPI used.
Instance:
<?php$sapi_type = Php_sapi_name (); if (substr ($sapi _type, 0, 3) = = ' cgi ') { echo "you are using CGI php\n";} else { C1/>echo "You were not using CGI php\n";}? >
2,array_map ()
The Array_map () function functions The user-defined function to each value in the array and returns a new array after the action. The number of arguments that the callback function accepts should be the same as the number of arrays passed to the Array_map () function.
Grammar:
Array_map (Myfunction,array1,array2,array3 ...)
MyFunction, required, name of user-defined function, or null;array1, required, specified array, array2, array3, optional, specified array.
Instance:
<?phpfunction MyFunction ($v) {if ($v = = = "Dog") { return "Fido"; } return $v;} $a =array ("Horse", "Dog", "Cat");p Rint_r (Array_map ("MyFunction", $a)); >
PHP php_sapi_name () and Array_map ()