Home >Backend Development >PHP Tutorial >循环中将循环中的不同值赋给不同变量

循环中将循环中的不同值赋给不同变量

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-23 13:47:061489browse

foreach ($query as $v){
    echo $v->data;  
   echo "
";
   }

$v是个对象, $v->data是不同的值, 有没有办法将它的所有值赋给不同的变量? m1 m2 m3 m4

先谢了


回复讨论(解决方案)

想出来了 给大家分享

$result = array();
   foreach ($query as $v){

    $result[] = $v->data;
    //echo $v->data; 
   echo "
";
  

   }

一时没绕过来弯,结贴。  可以给自己分吗? 呵呵

帮你接分 哈哈 !!

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