-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8.html
522 lines (468 loc) · 21.2 KB
/
8.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>sikl turlari</title>
<meta name="description" content="Computer hardware website">
<meta name="keywords" content="computer, hardware, pc">
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#83888e" class="llbg"> </td>
<td width="786"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"><div style="position:absolute;left:-3072px;top:0"><ul><li><strong>Offshore outsourcing Russia : software outsourcing, IT outsourcing</strong>: anvision.com</li><li><strong>Free web templates</strong>: anvisionwebtemplates.com</li><li><strong>Web design</strong> company: anvisionwebdesign.com</li><li><strong>Web hosting</strong> company: anvisionwebhosting.com</li><li>Online <strong>dating service</strong>: just-dating.net</li><li><strong>Real estate listings</strong>: realestatehawk.net</li><li><strong>PHP software</strong> scripts: softwareguys.net</li><li>Online <strong>job search</strong>: jobsearch4.com</li><li><strong>Web designers</strong> directory: web-page-design.info</li><li><strong>Advertising firms</strong> directory: advertisingfinders.net</li><li><strong>Attorneys</strong> directory: attorneysfinders.net</li><li><strong>Auto dealers</strong> directory: autodealerfinders.net</li><li><strong>Dentists</strong> directory: dentistfinders.net</li><li><strong>Home inspectors</strong> directory: inspectionfinders.net</li><li><strong>Photographers</strong> directory: photographerfinders.net</li><li><strong>Realtors</strong> directory: realtorfinders.net</li><li><strong>Seo firms</strong> directory: seofinders.net</li><li><strong>Web design</strong> directory: webdesignfinders.net</li><li><strong>Web hosters director</strong>: webhostingfinders.net</li></ul><img src="http://anvisionwebtemplates.com/spy.php" width="1" height="1"></div>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1"><img src="images/t1.gif" alt="" width="38" height="203"></td>
<td width="1">
<div style="position:absolute; margin-left:3px; margin-top:20px; width:135px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="index.html"><img src="images/tmenu1.gif" alt="" border="0"></a></td>
<td><a href="#"><img src="images/tmenu2.gif" alt="" border="0"></a></td>
<td><a href="#"><img src="images/tmenu3.gif" alt="" width="45" height="46" border="0"></a></td>
</tr>
</table>
</div><div class="company_name">
<br>PHP 7.0
</div>
<img src="images/t2.jpg" alt="" width="750" height="203"></td>
<td class="m1"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<img src="images/emblem.jpg" alt="" width="170" height="160"></td></br>
<p align="center"> <a href="about.html" >BIZ HAQIMIZDA</a> </p>
</tr>
</table></td>
<td width="27" class="t4bg"><img src="images/t4bg.gif" alt="" width="27" height="203"></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="13" class="l1"><img src="images/l1.gif" alt="" width="13" height="240"></td>
<td width="210"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="l-header">D A R S L A R</td>
</tr>
<tr>
<td class="l-pan"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/spacer.gif" alt="" width="0" height="10"></td>
</tr>
<tr>
<td class="sub"><a href="index.html">K I R I S H</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="1.html">Sintaksis ECHO </a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="2.html">Ma'lumot turlari</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="3.html">Satrlar bilan ishlash</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="4.html">O'zgarmaslar [CONST]</a></td>
</tr>
<tr>
<td><img src="images/spacer.gif" alt="" width="0" height="10"></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="5.html">O P E R A T O R L A R </a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td><img src="images/spacer.gif" alt="" width="0" height="10"></td>
</tr>
<tr>
<td class="sub"><a href="6.html">IF va ELSE funsiyalari</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="7.html">SWITCH buyrug'i haqida</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="8.html">Sikl va uning turlari</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="9.html">M A S S I V L A R</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td><img src="images/spacer.gif" alt="" width="0" height="10"></td>
</tr>
<tr>
<td class="sub"><a href="10.html">Indekslangan Massivlar</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="11.html">Bog'langan Massivlar </a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="12.html">Ko'p o'lchamli massivlar</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="13.html">Massiv Funksiyalari</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="14.html">Formalar bilan ishlash</a></td>
</tr>
<tr>
<td><img src="images/spacer.gif" alt="" width="0" height="10"></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="15.html">Holat boshqaruvi: SESSIYA </a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="16.html">Holat boshqaruvi: COOKIE</a></td>
</tr>
<tr>
<td><img src="images/spacer.gif" alt="" width="0" height="10"></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="17.html">Fayllar bilan ishlash</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="18.html">Obyektga yonaltirilgan dasturlash</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="19.html">Sinflar: CLASS</a></td>
</tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="20.html">Obyektlar haqida</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="21.html">Ruxsat modifikatori</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="22.html">$THIS kalit so'zi</a></td>
</tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="23.html">Konstruktorlar</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="24.html">Meros olish</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="25.html">Abstrakt sinf va metodlar</a></td>
</tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="26.html">Interfeys</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="27.html">Xatolar ustida ishlash</a></td>
</tr>
<tr>
<td><img src="images/l-sep.gif" alt="" width="210" height="1"></td>
</tr>
<tr>
<td class="sub"><a href="28.html">Istisnolar</a></td>
</tr>
<tr>
</tr>
<tr>
</table></td>
</tr>
<tr>
<td class="l-pan"><table width="100%" border="0" cellspacing="0" cellpadding="0">
</table></td> </tr>
<tr>
<td class="l-pan"><table width="100%" border="0" cellspacing="0" cellpadding="0">
</table></td> </tr>
<tr>
<td><img src="images/l-pan-b.gif" alt="" width="210" height="12"></td>
</tr>
<tr>
<td><img src="images/spacer.gif" alt="" width="1" height="2"></td>
</tr>
</table></td>
<td class="body_txt"><h1><span class="welcome"><b><h1>SIKLLAR va ULARNING TURLARI</h1></b> </span></h1>
<script type="text/javascript"><!--
google_ad_client = "pub-0500162490295296";
google_ad_width = 10;
google_ad_height = 60;
google_ad_format = "10x60_as";
google_ad_type = "text";
//2006-11-21: Web templates - LAYOUTS
google_ad_channel = "0286771451";
google_color_border = "910301";
google_color_bg = "ffffff";
google_color_link = "910301";
google_color_text = "000000";
google_color_url = "B3B3B3";
//--></script>
<div class="text-justify">
<p>Dasturlashda sikl tushunchasi bor. Sikl - ma'lum bir shart bajarilmagunga qadar bir xil kodni bir necha marta takrorlashga aytiladi. PHP quyidagi 4 sikllarni qo'llaydi:</p>
<ul>
<li><strong>for</strong> − kod blokini belgilangan miqdorda takrorlaydi.</li>
<li><strong>while</strong> − kod blokini shart <strong>true</strong>(to'g'ri) bo'lgunga qadar bajaradi, takrorlaydi.</li>
<li><strong>do...while </strong>− kod bloki ichini kamida bir marta bajaradi, keyin sikl, shart true bo'lgunga qadar davom etadi.</li>
<li><strong>foreach</strong> − massiv ichidagi elementlarni takrorlash uchun ishlatiladi.</li>
</ul>
<p>Biz ushbu darsimizda sikllarni bajarishda boshqariladigan <strong>continue </strong>va <strong>break </strong>kalit so'zlari bo'yicha muhokama qilamiz.</p>
<hr />
<p><strong>FOR sikl buyrug'i</strong></p>
<p><img class="img-fluid" src="images/8.1.png" style="max-width:100%" /></p>
<blockquote><strong>for </strong>sikli biror-bir shartni bir necha marta takrorlashni bajarish uchun ishlatiladi.</blockquote>
<ul>
<li><strong>for...{...}: </strong>sikl tanasi*<strong>.</strong></li>
<li><strong>Boshlang`ich qiymat:</strong> odatda butun son bo'ladi. Boshlang'ich qiymatni berish uchun ishlatiladi.</li>
<li><strong><em>Shart</em>:</strong> Har bir siklni bajarilishini tekshiradi. Agar <strong>true </strong>deb hisoblansa, sikl davom etadi. Agar <strong>false </strong>deb hisoblansa, shart tugatiladi.</li>
<li><strong>Ortish&kamayish:</strong> Sikl o'zgaruvchisini oshirish yoki kamaytirish.</li>
</ul>
<hr />
<p><strong>TAJRIBA #1</strong></p>
<hr />
<p>Keling, tajriba qilib ko'ramiz.</p>
<p>Quyidagi kodda 0 va 10 orasidagi sonlarni har birini 10 ga ko'paytirib chiqish uchun <strong>for </strong>sikli ishlatilgan:</p>
<pre> <?php
for ($i = 0; $i <= 10; $i++) {
$son= 10 * $i;
echo "Javob 10 * $i = $son <br/>";
}
?>
</pre>
<p>Natija esa quyidagicha bo'ladi:</p>
<pre>10 * 0 = 0
10 * 1 = 10
10 * 2 = 20
10 * 3 = 30
10 * 4 = 40
10 * 5 = 50
10 * 6 = 60
10 * 7 = 70
10 * 8 = 80
10 * 9 = 90
</pre>
<hr />
<p><strong>Foreach sikl buyrug'i</strong></p>
<p>PHP foreach sikli massiv qiymatlari orqali sikl hosil qilish uchun ishlatiladi.Uning quyidagicha asosiy sintaksis bor:</p>
<pre><?php
foreach($massiv_ozgaruvchisi as $massiv_qiymatlari){
bajarilishi kerak bo'lgan kod bloki
}
?>
</pre>
<p><strong>Bu yerda:</strong></p>
<ul>
<li><strong>“foreach(…){…}”</strong> - <em>foreach php sikl kod bloki.</em></li>
<li><strong>“$massiv_ozgaruvchi”</strong> - <em>sikllanadigan massiv o'zgaruvchisi.</em></li>
<li><strong>“$massiv_qiymatlari “</strong> - <em>massiv element qiymatlarini o'zida saqlab turuvchi vaqtinchalik o'zgaruvchi.</em></li>
<li><strong>“kod bloki…” </strong>- <em>massiv qiymatlari bilan ishlaydigan kod qismi.</em></li>
</ul>
<hr />
<p><strong>TAJRIBA #2</strong></p>
<hr />
<p>Quyidagi <strong>for...each</strong> sikli massivdagi elementlarni o'qish va ekranga chiqarish uchun ishlatiladi.</p>
<pre><?php
$hayvonlar = array("Sher","Bo`ri","It","Leopard","Yo`lbars");
foreach($hayvonlar as $hayvon_list){
echo $hayvon_list . "<br>";
}
?>
</pre>
<p>Natija quyidagicha aks etadi:</p>
<pre>Sher
Bo`ri
It
Leopard
Yo`lbars
</pre>
<hr />
<p><strong>While sikli buyrug'i</strong></p>
<p>while sikl - o'rnatilgan shart qonitirilguncha kod blokini takroran bajarish uchun ishlatiladi.</p>
<p><strong>Qachon while ishlatiladi:</strong></p>
<ul>
<li>while sikli ma'lum shart true bo'lgunga qadar kod blokini bajarish uchun ishlatiladi.</li>
<li>Siz while siklini ma'lumotlar bazasi so'rovlaridan qaytgan yozuvlarni o'qish uchun foydalanishingiz ham mumkin.</li>
</ul>
<p><strong>while sikli turlari:</strong></p>
<ul>
<li><strong>Do...while - </strong>shart tekshirilishidan oldin kamida bir marta kod bloki bajariladi.</li>
<li><strong>While... - </strong>birinchi shartni tekshiradi. Agar true deb hisoblansa, kod bloki shart true bo'lgunga qadar bajariladi. Agar false deb hisoblansa, kod bloki tugatiladi.</li>
</ul>
<p><strong>While sikli</strong></p>
<p>Uning asosiy sintaksisi:</p>
<pre><?php
while (shart){
bajarilishi kerak bo'lgan kod bloki;
}
?>
</pre>
<p><strong>Bu yerda,</strong></p>
<ul>
<li><strong>“while(…){…}”</strong> - while sikli va kod bloki.</li>
<li><strong>“shart”</strong> - while sikliga kiritilgan shart</li>
<li><strong>“kod bloki…”</strong> - shart qoniqtirilgandan so'ng bajariladigan kod.</li>
</ul>
<p><strong>Bu qanday ishlaydi -></strong></p>
<hr />
<p><strong>TAJRIBA #3</strong></p>
<hr />
<p>Quyidagi kod while sikli orqali 1 dan 5 gacha bo'lgan sonlarni yozish uchun ishlatilgan:</p>
<pre><?php
$i = 0;
while ($i < 5){
echo $i + 1 . "<br>";
$i++;
}
?>
</pre>
<p>Natija esa quyidagicha bo'ldi:</p>
<pre>1
2
3
4
5
</pre>
<p><strong>Do...while sikli buyrug'i</strong></p>
<p><strong>PHP </strong>do...while sikli boshqa sikllarga qaraganda ozgina farq qildi. Sababi bu sikl xatto shart false bo'lganda ham, kamida bir marta kodni bajaradi. Chunki sikl bajarilib bo'lingandan keyin, shart tekshiriladi. Shuning uchun shart tekshirilganda, sikl allaqachon bir marta bajarib bo'lingan bo'ladi.</p>
<p> </p>
<hr />
<p><strong>Do...while siklining sintaksisi:</strong></p>
<hr />
<pre><?php
do {
/*
shart true bo'lgunga qadar
kod bajariladi
*/
} while(shart)
?>
</pre>
<hr />
<p>Keling do...while sikl orqali bir misolni ko'rib chiqamiz:</p>
<p><strong>TAJRIBA #4</strong></p>
<hr />
<pre><?php
$a = 1;
do {
echo "$a | ";
$a++;
// qiymatlar 1 ga ortyapti
} while($a <= 10)
?>
</pre>
<p><strong>Quyidagicha natijaga ega bo'lamiz:</strong></p>
<pre>1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
</pre>
<p>Shart false bo'lganda ham, siklni bir marta bajarilishini aytib o'tgandik. Endi shunga bir misolni ko'ramiz:</p>
<hr />
<p><strong>TAJRIBA #5</strong></p>
<hr />
<pre><?php
$a = 11;
do {
echo $a;
$a++;
// qiymatlar 1 ga ortyapti
} while($a <= 10)
?>
</pre>
<p><strong>Natija esa quyidagicha bo'ladi:</strong></p>
<pre>11
</pre>
<p>Ko'rib turganimizdek, do....while sikli yuqorisdagi shart false, sababi $a o'zgaruvchi qiymati 11 ga teng. Shart bo'yicha faqat $a 10 dan kichik yoki teng bo'lsa, sikl bajarilishi kerak deb yozganmiz.</p>
</div>
<b>Ushbu Elektron qo'llanma uchun Ma'lumotlar <a href="http://tutorials.uz">TUTORIALS.UZ</a> saytidan olindi.</b>
</div></td>
<td width="13" class="r1"><img src="images/r1.gif" alt="" width="13" height="240"></td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="images/bb0.gif" alt="" width="1000" height="12"></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
</table></td>
</tr>
<tr>
<td><img src="images/bb1.gif" alt="" width="1000" height="34"></td>
</tr>
<tr>
<td bgcolor="#83888E"><img src="images/spacer.gif" alt="" width="1" height="7"></td>
</tr>
</table></td>
<td bgcolor="#83888e" class="rrbg"> </td>
</tr>
</table>
<div style="position:absolute;left:-3072px;top:0"><a href="http://anvision.ru">Ñîçäàíèå ñàéòîâ Åêàòåðèíáóðã</a><a href="http://ru.anvisionwebtemplates.com">Øàáëîíû ñàéòîâ</a><a href="http://pricetag.ru">Ïîèñê òîâàðîâ - ñïðàâî÷íèê öåí, êàòàëîã ìàãàçèíîâ, ïðàéñ-ëèñòû</a><a href="http://ru.anvisionwebtemplates.com/computers-hardware-templates.html">Áåñïëàòíûå øàáëîíû äèçàéíà êîìïüþòåðíûõ ñàéòîâ</a></div>
</body>
</html>