The join () function combines array elements into a string.
The join () function is the alias of the implode () function.
Example
<? Php tutorial
$ Arr = array ('hello', 'World! ', 'Beautiful', 'day! ');
Echo join ("", $ arr );
?> Output:
Hello world! Beautiful day!
The following is a dedecms search page condition using the join function.
If ($ this-> starttime> 0)
{
$ Ksqls [] = "arc. senddate> '". $ this-> starttime ."'";
}
If ($ this-> typeid> 0)
{
$ Ksqls [] = "typeid in (". getsonids ($ this-> typeid ).")";
}
If ($ this-> channeltype> 0)
{
$ Ksqls [] = "arc. channel = '". $ this-> channeltype ."'";
}
If ($ this-> mid> 0)
{
$ Ksqls [] = "arc. mid = '". $ this-> mid ."'";
}
$ Ksqls [] = "arc. arcrank>-1 ";
$ This-> addsql = ($ ksql = ''? Join ('and', $ ksqls): join ('and', $ ksqls). "and ($ ksql )");
It forms a where Condition for the select * from table, which is used to construct a complete SQL query statement based on the number of $ ksql statements.
Note: join () can receive two parameter sequences. However, explode () cannot be used for historical reasons. You must ensure that the separator parameter is prior to the string parameter.
Tables in the database tutorial can be linked by keys. A primary key is a column in which the values of each row are unique. In the table, the values of each primary key are unique. In this way, the data in each table is bundled together without repeating all the data in each table.