Created
May 31, 2019 15:53
-
-
Save douglasmartins7/9b8a2709ee65ffd0fcbf7239932d19b5 to your computer and use it in GitHub Desktop.
PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo '<br> Condicional: '; | |
$A = 4; | |
$B = 2; | |
if($A % 2 == 1){ | |
echo 'não é par então impar'; | |
} | |
else{ | |
echo 'Numero par'; | |
} | |
echo "<br>Laço while: "; | |
echo "Quando você quer que teste primeiro para funcionar"; | |
$i = 0; | |
while($i < 10){ | |
echo $i; | |
$i++; | |
} | |
echo '<br>Laço ado...while: '; | |
echo 'Quando você quer rode primeiro e depois teste se está certo'; | |
$i = 0; | |
do{ | |
echo $i; | |
$i++; | |
} while($i < 10); | |
echo '<br>Laço for: '; | |
for ($i = 0; $i < 10; $i++) { | |
echo $i; | |
} | |
echo '<br> Laço foreach: '; | |
$i = [0,1,2,3,4,5,6,7,8,9]; | |
foreach ($i as $j){ | |
echo $j; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment