File: basic-syntax.xml

package info (click to toggle)
phpdoc 20020310-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 35,272 kB
  • ctags: 354
  • sloc: xml: 799,767; php: 1,395; cpp: 500; makefile: 200; sh: 140; awk: 51
file content (251 lines) | stat: -rw-r--r-- 9,160 bytes parent folder | download
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
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
 <chapter id="language.basic-syntax">
  <title>Temel sz dizimi</title>

   <!--
   
    NOTE:                             Last modified: 2001-05-16 13:00 GMT
    
    the language part is currently under heavy revision. Please do not
    not make any heavy (i.e. structural) modifications to this part 
    for a moment. 
    
    You'd also better not start any translation yet.
    
    Comments are always welcome at phpdoc@lists.php.net
    
    Progress:
    
     intro : DOESN'T EXIST - yet?
             new chapter, with some introductionary remarks?
             Will be discussed on the ML soon.
     basic-syntax: 
             FINISHED
             except maybe moving the 'advanced escaping'
             to a better place?
             TODO: 
              - nada
     types : Being revised. Added all new types
             Boolean and Integer are more or less finished.
             The rest isn't.
             TODO: 
              - why is $foo[bar] bad syntax?
              - what's the difference between unset($bla) and
                $bla = NULL; (it is different!)
              - $obj->{expr} syntax
              - (unset) cast?????
              - $bla = unset <== should've been nuked, don't mention it
              - $str{offset} syntax, rather than $str[offset]
              - read notes and apply when any of them are useful
              - remove notes which have been included here.
              - ...
     the rest: Not yet started with.
             TODO: 
              - ?
     oop   : has been revised by Kristian, DONE.
   -->
   
  <sect1 id="language.basic-syntax.phpmode">
   <title>HTML'den Ka&inodot;&scedil;</title>
  
   <para>
   PHP bir dosyay&inodot; okurken, kendisine taranan metnin PHP kodu oldu&gbreve;unu
   syleyen zel etiketlerden birine rastlay&inodot;ncaya kadar dosyadaki metni i&scedil;lemeden
   geirmekle yetinir. Bu etiketler aras&inodot;ndaki kod ise, bir sonland&inodot;rma etiketiyle
   kar&scedil;&inodot;la&scedil;&inodot;l&inodot;ncaya kadar al&inodot;&scedil;t&inodot;r&inodot;l&inodot;r, ve sonland&inodot;rma etiketiyle birlikte tekrar i&scedil;lemeden
   geirme i&scedil;lemine devam edilir. Bu mekanizma, PHP'yi HTML kodunun iine
   gmme imkan&inodot; sa&gbreve;lar: PHP etiketlerinin d&inodot;&scedil;&inodot;ndaki her &scedil;ey oldu&gbreve;u gibi b&inodot;rak&inodot;l&inodot;r,
   ierdeki her &scedil;ey kod kabul edilerek taran&inodot;r.
   </para>

   <para>
   PHP kod blo&gbreve;unu belirtmek iin drt farkl&inodot; etiket biimi vard&inodot;r. Bunlardan
   yaln&inodot;zca iki tanesi (&lt;?php. . .?&gt; ve &lt;script
    language="php"&gt;. . .&lt;/script&gt;) her zaman mevcuttur; di&gbreve;erleri
    <filename>php.ini</filename> konfigrasyon dosyas&inodot; iersinden a&inodot;labilir
    ya da kapat&inodot;labilir. K&inodot;salt&inodot;lm&inodot;&scedil; etiketler ve ASP-tipi etiketler kullan&inodot;&scedil;l&inodot; olabilir,
    ancak uzun biimleri kadar ta&scedil;&inodot;nabilir de&gbreve;ildirler. Ayr&inodot;ca, PHP kodunu XML ya da
    XHTML kodunun iine gmmek istiyorsan&inodot;z, XML ile uyum sa&gbreve;lamak iin
   &lt;?php. . .?&gt; biimini kullanmal&inodot;s&inodot;n&inodot;z.
   </para>

   <para>
   PHP taraf&inodot;ndan desteklenen etiketler:
   </para>

    <para>
     <example>
      <title>HTML'den kama yntemleri</title>
      <programlisting role="php">
<![CDATA[
1.  <? echo ("bu en basit, SGML benzeri kullanimdir\n"); ?>
    <?= expression ?> kullan&inodot;m&inodot; bu kullan&inodot;m&inodot;n k&inodot;salt&inodot;lm&inodot;&scedil;&inodot;d&inodot;r "<? echo expression ?>"
    
2.  <?php echo("XHTML ya da XML dokmanlari sunuyorsaniz, bu sekilde yapin\n"); ?>

3.  <script language="php">
        echo ("bazi editrler (FrontPage gibi) bu kullanimi sevmezler");
    </script>

4.  <% echo ("Tercihe bagli olarak ASP-tipi etiketler kullanabilirsiniz"); %>
    <%= $variable; # "<% echo . . ." %> iin kisaltilmis kullanimdir
]]>
      </programlisting>
     </example>
    </para>

   <para>
   &Idot;lk kullan&inodot;m biimi yaln&inodot;zca k&inodot;sa etiket kullan&inodot;m&inodot; etkinle&scedil;tirilmi&scedil;se mevcuttur.
   Bu i&scedil;lem <function>short_tags</function> ile (yaln&inodot;zca PHP 3), 
   PHP ayar dosyas&inodot;ndaki <link
    linkend="ini.short-open-tag">short_open_tag</link> konfigrasyon seene&gbreve;i
    etkinle&scedil;tirilerek, ya da PHP <command>configure</command> al&inodot;&scedil;t&inodot;r&inodot;l&inodot;rken
    --enable-short-tags eklenerek yap&inodot;labilir.
   </para>

   <para>
   &Idot;kinci yol genel olarak tercih edilen yntemdir, PHP'nin XHTML gibi XML-uyumlu kodlar
   ile birlikte uyum iersinde al&inodot;&scedil;mas&inodot;n&inodot; sa&gbreve;lar.
   </para>

   <para>
   Drdnc yol yaln&inodot;zca ASP-tipi etiketler <link linkend="ini.asp-tags">asp_tags</link>
   konfigrasyon ayar&inodot; etkinle&scedil;tirilmi&scedil;se kullan&inodot;labilir.
    <note>
     <para>ASP-tipi etiketler iin destek 3.0.4 srmnde eklenmi&scedil;tir.</para>
    </note>
   </para>

   <para>
   Kod blo&gbreve;u iersinde kullan&inodot;lan sonland&inodot;rma etiketi otomatik olarak blo&gbreve;un
   sonuna bir yeni sat&inodot;r i&scedil;areti ekleyecektir. Ayr&inodot;ca, sonland&inodot;rma etiketi
   otomatik olarak noktal&inodot; virgl uygulamas&inodot;n&inodot; yapar; PHP blo&gbreve;unun son sat&inodot;r&inodot;n&inodot;
   noktal&inodot; virgl ile kapatmaz zorunda de&gbreve;ilsiniz.
   </para>
    
    <para>
   PHP a&scedil;a&gbreve;&inodot;dakine benzer yap&inodot;lar&inodot;n kullan&inodot;m&inodot;na imkan tan&inodot;r: 
    <example><title>Geli&scedil;mi&scedil; ka&inodot;&scedil;</title>
     <programlisting role="php">
<![CDATA[
<?php
if ($expression) { 
    ?>
    <strong>Sonu dogru.</strong>
    <?php 
} else { 
    ?>
    <strong>Sonu yanlis.</strong>
    <?php 
}
?>
]]>
     </programlisting>
    </example>
   Bu kendisinden beklendi&gbreve;i gibi al&inodot;&scedil;&inodot;r, nk PHP ?&gt; sonland&inodot;rma etiketi
ile kar&scedil;&inodot;la&scedil;t&inodot;&gbreve;&inodot;nda, bir ba&scedil;latma etiketi ile kar&scedil;&inodot;la&scedil;ana kadar buldu&gbreve;u her &scedil;eyi
bakmadan geirmekle yetinir. Buradan verilen rnek elbette gereksiz gzkebilir,
ama geni&scedil; metin bloklar&inodot;n&inodot;n &inodot;kt&inodot;s&inodot; verilirken, PHP tarama modundan &inodot;kmak
genellikle btn metni <function>echo</function> ya da <function>print</function>
ile vermekten daha verimlidir.
   </para>
  </sect1>
  
  <sect1 id="language.basic-syntax.instruction-separation">
   <title>Komut ayr&inodot;m&inodot;</title>
   
   <simpara>
   Komutlar birbirlerinden C ya da Perl'de oldu&gbreve;u gibi ayr&inodot;l&inodot;rlar - btn komutlar
   noktal&inodot; virgl ile sonland&inodot;r&inodot;l&inodot;r.
   </simpara>

   <para>
   Sonland&inodot;rma etiketi (?&gt;) ayn&inodot; zamanda komutun sona erdi&gbreve;ini belirtir,
   bu nedenle a&scedil;a&gbreve;&inodot;daki iki kullan&inodot;m birbirine denktir:
    <informalexample>
     <programlisting role="php">
<![CDATA[
<?php
    echo "Bu bir denemedir";
?>

<?php echo "Bu bir denemedir" ?>
]]>
     </programlisting>
    </informalexample>
   </para>
  </sect1>

  <sect1 id="language.basic-syntax.comments">
   <title>Yorumlar</title>
   
   <para>
   PHP, 'C', 'C++' ve Unix kabuk-tipi yorum kullan&inodot;m&inodot;n&inodot; destekler. rne&gbreve;in:
    <informalexample>
     <programlisting role="php">
<![CDATA[
<?php
    echo "Bu bir denemedir"; // Bu tek satirlik c++ tipi yorumdur
    /* Bu coklu satir yorumudur
       ve bir baska satir daha */
    echo "Bu diger bir testtir";
    echo "Son Bitis Testi"; # Bu kabuk-tipi yorumdur
?>
]]>
     </programlisting>
    </informalexample>
   </para>

   <simpara>
   "tek-sat&inodot;rl&inodot;k" yorum kullan&inodot;m&inodot; genellikle sat&inodot;r sonunda ya da geerli PHP
   kod blo&gbreve;unun sonunda kullan&inodot;l&inodot;r.
   </simpara>
   <informalexample>
    <programlisting role="php">
<![CDATA[
<h1>Bu bir <?php # echo "basit";?> rnektir.>/h1>
<p>Yukardaki baslik 'Bu bir rnektir' yazdiracaktir.</p>
]]>
    </programlisting>
   </informalexample> 

   <simpara>
   'C' tipi yorumlar&inodot; birbirlerinin iine geirmemeye dikkat edin, bu durum
   zellikle byk bloklar&inodot; yorum iine al&inodot;rken gerekle&scedil;ebilir.
   </simpara>

   <informalexample>
    <programlisting role="php">
<![CDATA[
<?php
 /* 
    echo "Bu bir denemedir"; /* Bu yorum soruna neden olur */
 */
?>
]]>
    </programlisting>
   </informalexample>
  </sect1>
 </chapter>
 
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->