Implode ()
Function Name: implode ()
Function category: string functions
Description: The connected array is a string.
Function example: implode ("|", $ array );
Function prototype: implode (string, array );
Parameter description:
String: A required parameter. It is a string used to connect to an array unit.
Array: A required parameter. Its value is an array used for connection.
Description: concatenates an array into a string using the specified string.
Example:
Code
<? Php
// Define an array
$ Array = array ("my", "Hometown", "in", "Far Away ");
// Concatenate an array without a specified string
$ String = implode ("", $ array );
// Display the connected Array
Echo $ string;
Echo "<br> ";
// Use | as the connection string
$ String = implode ("|", $ array );
// Display the connected Array
Echo $ string;
?>
Output result:
My hometown is far away
My | hometown | in | far away
Note: The implode () function can be used for binary file operations.