Home  >  Article  >  Backend Development  >  Usage code example of php join function

Usage code example of php join function

怪我咯
怪我咯Original
2017-07-13 10:03:531831browse

The

join() function returns a string composed of array elements. The

join() function is an alias of the implode() 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn