11.09.2018 Views

Aprender a desarrollar un sitio Web con PHP y MySQL

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

24/4/2014 ENI Training - Libro online<br />

}<br />

}<br />

?><br />

Da como resultado :<br />

Hola<br />

Hola<br />

Hola<br />

Hola<br />

Hola<br />

El bucle se detiene cuando $i es igual a 5 (y no a 10).<br />

2. While<br />

El bucle while significa «mientras que», es decir, el bucle se ejecutará siempre y cuando <strong>un</strong>a <strong>con</strong>dición<br />

sea verdadera.<br />

Por ejemplo, para mostrar diez veces «Hola», solo debe escribir <strong>un</strong> bucle while:<br />

<br />

La variable $i represtenta el <strong>con</strong>tador del bucle. Pero mientras $i sea inferior o igual a 10, se repetirá<br />

el bucle.<br />

Por lo tanto, la sintaxis es:<br />

$i=número inicial<br />

while ($i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!