Detailed explanation of php implode() function example
May 23, 2017 pm 02:53 PMWhat is the function of php implode() function?
The implode() function in php returns a string composed of array elements. It has the opposite effect to the php explode() function. php explode() The function is: split a string using another string and return an array of strings.
Understanding the role of the php implode() function, let’s take a look at the syntax and examples of the php implode() function
Grammar
implode(separator,array)
Parameter details:
Description | |
---|---|
separator | Optional. Specifies what is placed between array elements. Default is "" (empty string).|
array | Required. Arrays to be combined into strings.
Example
Use different characters to separate array elements, the code is as follows:<?php $arr = array('Hello','World!','Beautiful','Day!'); echo implode(" ",$arr)."<br>"; echo implode("+",$arr)."<br>"; echo implode("-",$arr)."<br>"; echo implode("X",$arr); ?>
php explode() function example detailed explanation
2.Use of php explode() function method
The above is the detailed content of Detailed explanation of php implode() function example. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Convert array to string using implode() function in PHP

How to use PHP explode function and solve errors

PHP Warning: implode(): Invalid arguments passed solution

Split and merge strings using the explode and implode functions

Common errors and solutions when using the explode function in PHP

How to use implode function to concatenate array elements into string in PHP

Introduction to the usage of PHP implode() function

Split string into array using PHP function 'explode'
