PHP Chinese string Inversion instance code
The PHP string inversion function, String Strrev (String $str), has only one parameter, which is the string to invert. Instance Program:
Echostrrev ("Hello world!"); Outputs "!dlrowolleh" UTF8 Chinese string Inversion instance code:
function Strrev_utf8 ($STR) {return join ("", Array_reverse (Preg_split ("//u", $str)));}
Print (Strrev_utf8 ("Hello, PHP Code Bar"));//output: Bar code generation PHP, good you
PHP array to string –join method php Array to string method Many, the most primitive idea is to use a for loop, to iterate through the string in the array. In this article we use the Join method.
The Join method has two parameters, the first parameter specifies the contents of the connection string, and the second parameter is the array instance code: $array = Array (' LastName ', ' email ', ' phone '); $comma _separated = Join (",", $array);
echo $comma _separated; Lastname,email,phone the case of multidimensional arrays:
Functionjoinr ($join, $value, $lvl =0)
PHP Chinese string Inversion instance code