Home > Backend Development > PHP Tutorial > 搞不明白的function里的while

搞不明白的function里的while

WBOY
Release: 2016-06-13 12:47:03
Original
923 people have browsed it

弄不明白的function里的while

<br />
    function wuMing(){<br />
    global $mysqli;<br />
    $x="select * from x";<br />
    $xun=$mysqli->query($x);<br />
    $i=0;<br />
    while($x=$xun->fetch_assoc()){<br />
        echo $a=$x['Name'],$i++.'<hr>';<br />
        wuMingShengCheng($a);<br />
    }<br />
}<br />
Copy after login


wuMingShengCheng 是1个生成HTML的函数。
通过传来的$a 去循环1个栏目下的文章。

当执行 wuMing(); 时。
里面的  while 循环了 第一个,执行了wuMingShengCheng();
在循环 while 也echo $a出来了 但不执行wuMingShengCheng();

输出的结果是

  $a  输出成功
  $a   生成成功
  $a  输出成功
  然后无下文了

在while里,如不执行wuMingShengCheng($a);的话
输出时完整的。例如$a里有5条记录。都能完整输出。

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