Home > Backend Development > PHP Tutorial > Usage code example of php join function

Usage code example of php join function

怪我咯
Release: 2023-03-13 19:42:02
Original
1874 people have browsed it

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)
Copy after login

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);
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template