Home  >  Article  >  Backend Development  >  在PHP中结果集,该如何解决

在PHP中结果集,该如何解决

WBOY
WBOYOriginal
2016-06-13 12:26:44729browse

在PHP中结果集
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));
$s 中就是你要的结果

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