-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path21.html
384 lines (360 loc) · 21 KB
/
21.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
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>ruxsat</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>ruxsat modifikatori</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>Klass metodlari va o'zgaruvchilariga kirish huquqlarini o'rnatish uchun biz php kalit so'zidan iborat ya'ni access modifiers dan foydalanamiz. Hatto biz klassni saqlab turish uchun klassga Access Modifiers larni belgilashimiz ham mumkin.</p>
<p>Access Modifiers sifatida ishlatiladigan php kalit so'zlar quyidagilardan iborat:</p>
<ol>
<li><code>public</code>: sinf(class) a'zolarini ommaviy deb belgilaganimizda, keyin ular hamma joydan kirishga moyil bo'ladi, hattoki sinf sohasidan tashqarida ham.</li>
<li><code>private</code>: sinf(class) a'zolarini shaxsiy deb belgilaganimizda, ular faqatgina o'z sinfi ichidangina kirishga moyil bo'ladi.</li>
<li><code>protected</code>: Bu ham shaxsiy ga o'xshab ketadi bitta istisnodan tashqari ya;ni, protected deb belgilangan sinf a'zolari uning subclasslaridangina kirishga moyil bo'ladi.(Subclasslar haqida Inheritance bilan tanishganimizda ko'proq bilib olasiz).</li>
<li><code>abstract</code>: Bu kalit so'z faqat PHP classlar va uning a'zo funksiyalari uchun ishlatiladi.</li>
<li><code>final</code>: final sifatida belgilangan class metodlar, hech qanday subclasslar tomonidan o'zgartirib ham rad etib ham bo'lmaydi.</li>
</ol>
<hr />
<h3>Qachon qaysi access modifier ishlatiladi?</h3>
<p>Biz barcha Access Modifier larni class, uning o'zgaruvchilari va metodlari bilan birga ishlatolmaymiz. Quyidagi jadvalda, qaysi access modifier qaysi bilan ishlatilishi ko'rsatilgan:</p>
<p><img class="img-fluid" src="images/21.1.png" style="max-width:100%" /></p>
<p>image</p>
<p>Endi qaysi access modifier qayerda ishlatilishini bilib oldik, kelin hozir ularni batafsil misollar bilan ko'rib chiqamiz:</p>
<hr />
<h3><strong>public </strong>access modifier</h3>
<p>Agar biz hech qanday access modifier ni belgilamasak, barcha klass va uning a'zolari standart <strong>public </strong>sifatida bo'ladi. Yuqorida aytilganidek, <strong>public</strong>, <strong>private </strong>yoki <strong>protected acmos* </strong>lar class lar bilan birga ishlatilmaydi. Agar ishlatilsachi, nima bo'ladi:</p>
<blockquote><strong>*acmos</strong> - access modifiers</blockquote>
<p><img class="img-fluid" src="images/21.2.png" style="max-width:100%" /></p>
<p><strong>Natija:</strong></p>
<p><code>Parse error: syntax error, unexpected 'public' (T_PUBLIC) in ...</code></p>
<p>Yuqorida bizda xato kelib chiqdi.</p>
<p>Ammo klass metodlar va o'zgaruvchilariga acmosni belgilashimiz mumkin, garchi ular standart <strong>public </strong>bo'lsa ham.</p>
<p><img class="img-fluid" src="images/21.3.png" style="max-width:100%" /></p>
<p>Yuqoridagi kodda biz klass o'zgaruvchisi oldidan <strong>var </strong>kalit so'zini ishlatdik. Agar uni ishlatmasak, <strong>parse error</strong> xatoligiga duch kelamiz.</p>
<p>Ammo var kalit so'zining o'rniga acmos kalit so'zlarni ishlatishimiz mumkin. Misol uchun:</p>
<p><img class="img-fluid" src="images/21.4.png" style="max-width:100%" /></p>
<hr />
<h3><strong>private </strong>acmos</h3>
<p>private acmosni klass o'zgaruvchilari va metodlari uchun ishlatishimiz mumkin ammo klass uchun emas! Klass a'zosi - o'zgaruvchi yoki funksiya private sifatida e'lon qilingandan keyin unga shunchaki klass obyekti orqali to'g'ridan-to'g'ri kirib bo'lmaydi. Masalan:</p>
<p><img class="img-fluid" src="images/21.5.png" style="max-width:100%" /></p>
<p>Yuqorida <strong>lname </strong>va <strong>fname </strong>private klass o'zgaruvchilar hisoblanadi shuning uchun biz ularga to'g'ridan to'g'ri klass obyektidan foydalanib kirolmaymiz.</p>
<p>Quyidagi bir qator kodni sinab ko'rsak:</p>
<pre><?php
$john->setFName("John");
?></pre>
<p>fatal PHP error ga duch kelamiz:</p>
<p><code>Fatal error: Cannot access private property Person::$fname in ...</code></p>
<p>Ammo biz klassning private o'zgaruvchilariga klassda public funksiyani belgilash orqali dostup olishimiz mumkin. Biz alohida private o'zgaruvchilarga qiymat kiritish va ularning qiymatlarini chiqarish uchun funksiyalar yaratamiz. U funksiyalar Getter(Oluvchi) va Setter(Kirituvchi) deb ataladi.</p>
<p><img class="img-fluid" src="images/21.6.png" style="max-width:100%" /></p>
<p><strong>Natija:</strong></p>
<p><code>Mening ismim: John Wick </code></p>
<p>Bizda klassda barcha private o'zgaruvchilar uchun getter va setter metodlar bo'lishi kerak!</p>
<hr />
<h3><strong>protected </strong>acmos</h3>
<p>Bu ham oddiy <strong>private </strong>acmos ga o'xshab, <strong>protected </strong>ham klass tashqarisidagi klass o'zgaruvchilar va metodlarini cheklaydi. Ammo protected klass o'zgaruvchi va funksiyalarga klass ichida va subclass(klassni meros qilib oladigan klass) ichida kirish mumkin.</p>
<p>Biz "meros qilib olish tushunchasi" va subklassni yaratish bo'yicha ko'proq kelgusi darslarimizda tanishamiz.</p>
<p><strong>protected acmos namuna:</strong></p>
<p><img class="img-fluid" src="images/21.7.png" style="max-width:100%" /></p>
<p>Yuqoridagi kodda, 2ta klass belgiladik, Human va Male. Male klasi Human klasining subklassi hisoblanadi.</p>
<p>Human klasida barcha klass o'zgaruvchilari va metodlari <strong>protected , </strong>shuning uchun ularga klassning tashqarisidan kirib bo'lmaydi. Ammo ularga Human subklassi Male klassi ichidan kirish imkoni mavjud.</p>
<p>Agar Inheritance tushunchasi past(sizda) sababli chalkash bo'lib ko'rinsa havotir olmang, keyingi Inheritance bo'yicha darslarimizda qaytamiz bu mavzuga.</p>
<hr />
<h3><strong>abstract </strong>acmos</h3>
<p>abstrakt acmosi PHP klass va funksiyalar bilan birga ishlatiladi. U klass o'zgaruvchilari bilan birga ishlatilmaydi.</p>
<p>Agar klassda hatto bitta abstrakt metod bo'lsa ham, klass ham abstrakt sifatida belgilanishi kerak.</p>
<p>Shuningdek, PHP abstrakt klassni amalga oshirishda imkon bermaydi bu degani siz abstrakt klassni obyektini yaratolmaysiz hatto klasslar meros qilib olinishi mumkin bolsa ham.</p>
<p>Bu haqida Abstrakt va Interfeyslar mavzusida o'rganamiz.</p>
<hr />
<h3><strong>final </strong>acmos</h3>
<p>Klassni <strong>final </strong>acmos sifatida belgilaganimizdan keyin klass meros qilib olinmaydi.</p>
<p>Huddi shunday, klass funksiyasini <strong>final </strong>deb belgilaganimizda, PHP klassning subklasslari final deb belgilangan funksiya ustidan dominant bo'lib qolmaslikni nazorat qiladi ya'ni cheklaydi. Bu haqida to'liq ma'lumot keyingi darslarimizda...</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>