The implode () and explode () functions of PHP functions are different. In previous articles, we have introduced the usage of the explode () function. When we encounter the PHP function implode (), the array elements are combined into a string. Implode (separator, we have introduced the specific usage of the explode () function in previous articles. When we encounter the PHP function implode (), the array elements are combined into a string.
Implode (separator, array)
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.
Although the separator parameter is optional. However, we recommend that you use two parameters for backward compatibility.
Example of PHP function implode ()
-
- $ Arr = array ('hello', 'World! ', 'Beautiful', 'day! ');
- Echo implode ("", $ arr );
- ?>
Output:
Hello World! Beautiful Day!
The above code example shows the specific implementation functions of the PHP function implode.
The usage of the aggregate () function. When we encounter the PHP function implode (), the array elements are combined into a string. Implode (separator ,...