PHP dasturlash tilida sikl operatorlari.

For, While, Do-While, For-each


Oddiy misollar orqali php da takrorlash operatorlarini ko'rsatib o'taman.

For sikl operatori:

<?php for ($x = 0; $x <= 5; $x++) { echo "The number is: $x <br>"; } ?>


While sikl operatori:

<?php $x = 1; while($x <= 5) { echo "The number is: $x <br>"; $x++; } ?>


Do-While sikl operatori:

<?php $x = 1; do { echo "The number is: $x <br>"; $x++; } while ($x <= 5); ?>


For-each sikl operatori:

<?php $x=array("3","2","1"); foreach ($x as $value) { echo $value . " "; } ?>

Comments

Popular posts from this blog