PHP implode
The PHP implode function can combine the array elements of PHP Array into a new string, and according to the needs of the system or design, you can set the string characters in series by yourself, showing the characteristic string content, which is converted by the implode function Strings, do not need print_r or loop output, you can directly use echo to output to the web page.
PHP implode basic syntax
string implode (string hyphen, $array) or string implode ($array)
The first parameter "concatenation character" of the implode function has been changed to select items since PHP 4.3.0. In other words, it is fine to not write, but if you do not write, each array element will be directly stringed together. In the following example, you can see the rendering results. The second parameter $array must be written, which is the original array to be converted.
PHP implode example
$new_array = array('Welcome','to','Wibibi.');
echo implode($new_array).'<br>';
echo implode('',$new_array).'<br>' ;
echo implode('-',$new_array);
?>
Welcome to Wibibi.
Welcome-to-Wibibi.
Post a Comment
0 Comments