Home > Backend Development > PHP Tutorial > 在PHP中结果集

在PHP中结果集

WBOY
Release: 2016-06-20 12:45:31
Original
875 people have browsed it

array (size=355)
  0 => 
    array (size=1)
      'title' => string '语文' (length=0)
  1 => 
    array (size=1)
      'title' => string '英语' (length=1)
  2 => 
    array (size=1)
      'title' => string '数学' (length=2)
  3 => 
    array (size=1)
      'title' => string '物理' (length=2)
  4 => 
    array (size=1)
      'title' => string '化学' (length=2)
  5 => 
    array (size=1)
      'title' => string '生物' (length=2)

以上是得到的结果集 。  我需要得到的是一串字符串:   语文,英语,数学,物理,化学,生物


回复讨论(解决方案)

设取得的数组为 $a,则有

$s = join(',', array_map('current', $a));
Copy after login
$s 中就是你要的结果

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