The
join() function returns astringcomposed of array elements. The
join() function is an alias of theimplode() function.
Note: The join() function accepts two parameter orders. However, due to historical reasons,explode() does not work. You must ensure that the separator parameter comes before the string parameter.
Grammar
join(separator,array)
This article mainly introduces the application of php joinfunction. Friends in need can refer to it.$key = array();
$val = array(); foreach ($_POST as $k=>$v) { $key[] = '`'.strip_tags(mysql_real_escape_string(trim($k))).'`'; $val[] = "'".strip_tags(mysql_real_escape_string(trim($v)))."'"; } $keys = join(",",$key); $vals = join(",",$val);
The above is the detailed content of Usage code example of php join function. For more information, please follow other related articles on the PHP Chinese website!