jueves, 19 de febrero de 2015

while and break and continue

$i = 1;
while ($i <= 10) {
    echo $i++."<br>";
   
    if ($i==6)
    {
    echo "founded $i";
   
    break;
   
    }
   
    }
   

1
2
3
4
5
founded 6



------------
$i = 1;
while ($i <= 10) {
    echo $i++."<br>";
   
    if ($i==6)
    {
    echo "founded $i";
   
    continue;
   
    }
   
    }
    



1
2
3
4
5
founded 66
7
8
9
10

No hay comentarios:

Publicar un comentario