How to Learn PHP implode ()
Implode function understanding 1
The implode () function combines array elements into a string.
1. How to understand array elements;
2. Whether the array element is a target object;
3. Whether the purpose is to integrate into a string;
Implode function understanding 2
Syntax
Implode (separator, array)
1. Whether the implode parameter 1 separator is added to each key value of the array;
2. Whether the implode Parameter Two array is an array of objects;
Parameters
Description
Optional. Specifies the content to be placed between array elements. The default value is "" (Null String ).
Array is required. Array to be combined as a string.
Description
Although the separator parameter is optional. However, we recommend that you use two parameters for backward compatibility.
1. Is the separator parameter optional;
2. Required for implode parameter 2 arra;
Tips and comments
Note: implode () can receive two parameter sequences. However, explode () cannot be used for historical reasons. The separator parameter must be set before the string parameter.
Implode function 3
<? Php
$ Arr = array ('h', 'I', 'J', 'K! ');
Echo implode ('M', $ arr );
?>
Output result: Hm Im Jm K!
<? Php
$ Arr = array ('h', 'I', 'J', 'K! ');
Echo implode ('', $ arr );
?>
Output result: h I J K!