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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 13:47:06
Original
1490 people have browsed it

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 "
";
  

   }

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

帮你接分 哈哈 !!

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