PHP - cycles

in #ua6 years ago (edited)

PHP - cycles







Cycles Цикли
I tell you, earlier, PHP is a server side programming language. Programs or scripts are interpreted in special daemon , and do some work.
Like mostly others programming languages , PHP contain cycle constructions in few variants.
FOR,WHILE,DO..WHILE,FOREACH

cycle with precondition WHILE


if logical expression is true ,than do cycle script,if false go to another operator(example 1)
Як вам раніше уже писав, PHP являє собою мову програмування на стороні сервера. Програми або скрипти інтерпретуються в спеціальному демоні та виконують певну роботу.
Як і більшість інших мов програмування, PHP містять циклові конструкції в декількох варіантах.
FOR,WHILE,DO-WHILE,FOREACH

цикл з передумовою WHILE


якщо логічний вираз істинний, ніж робити сценарій циклу, якщо ложно перейти до іншого оператора(приклад 1)
<?php
while(logical epression){
  //cycle script
}
//or 
while(logical expression):
  //cycle script
endwhile;

(example 1/приклад 1)



cycle with aftercondition DO..WHILE


logical expression will be checked after cycle script done(example 2)

цикл з післяумовою DO..WHILE


логічний вираз буде перевірено після завершення сценарію циклу(приклад 2)
<?php
do{
   //cycle script
}while(logical epression)

(example 2/приклад 2)



сycle with counter FOR


used when need to do cycle script some count of times(example 3)

цикл з лічильником FOR


використовується, коли потрібно виконувати сценарій циклу кілька разів(приклад 3)
<?php
for(initializing_commands;cycle condition;after_script_commands){
   //cycle script
}
//or
for(initializing_commands;cycle condition;after_script_commands):
   //cycle script
endfor;

(example 3/приклад 3)



array overflow cycle FOREACH


The name of this cycle speaks for itself.(example 4)

цикл перебору масиву FOREACH


Назва цього циклу говорить сама за себе(приклад 4)
foreach (array as $key=>$value){
// cycle script
}
///or
foreach (array as $value){
// cycle script
}

(example 4/приклад 4)

In second part of this article we will spoke about 'break' and 'continue' constructions, and I will prepare for you some examples with all cycles constructions.

У другій частині цієї статті ми говоримо про конструкції "break" та "continue", і Я підготую вам кілька прикладів з усіма циклічними конструкціями.

FINGER UP!!!COMMENT AND FOLLOW!!!!!

I will be glad new friends,
yours support,
and criticism



Sort:  

You got a 4.02% upvote from @boinger courtesy of @mandarin2016!

Hey @mandarin2016, Congratulations! Bodzila just upvoted your post with 53.76% power. Keep up the good work!

Delegate your Steem Power to @Bodzila & Earn 80% Weekly returns based on your share. You can cancel delegation of your SP at anytime as the money & power remain in your hands only.

Any queries or required support can be discussed in person. Join our discord channel https://discord.me/SteemBulls

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by mandarin2016 from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.

You got a 19.57% upvote from @shares courtesy of @mandarin2016! This is a service sponsored by @Yehey. Please consider voting for @Yehey as one of your Witness. Use this short URL link https://on.king.net/witness simply click and vote, this will redirect to steem connect for secure connection.

If you need an extra upvote, join us at https://SteemChat.com discord server. Or simply hang out and meet new friends with common interest.

WANTED SP DELEGATION. Let your Steem Powers (SP) works for you. Delegate SP to receive daily payouts. Choose the amount of your delegation. Start small or go big, it's all up to you.
10 SP
50 SP
100 SP
200 SP
500 SP
1000 SP
2000 SP
3000 SP
5000 SP
10000 SP
20000 SP
50000 SP
100000 SP
500000 SP
1000000 SP

Have a fun day.
@Shares - Keep Steeming for a better future.

You got a 1.67% upvote from @minnowvotes courtesy of @mandarin2016!