cvs: phpdoc-si /language control-structures.xml
[email protected] ("Dejan Markic") Mon, 02 Sep 2002 14:15:57 -0000
| Newsgroups | php.doc.sl |
|---|---|
| Message-ID | <cvsdejan1030976157@cvsserver> |
dejan Mon Sep 2 10:15:57 2002 EDT
Modified files:
/phpdoc-si/language control-structures.xml
Log:
Back home. Still no error checking.
dejan-20020902101557.txt
(text/plain, 23.5 KB)
Index: phpdoc-si/language/control-structures.xml
diff -u phpdoc-si/language/control-structures.xml:1.2 phpdoc-si/language/control-structures.xml:1.3
--- phpdoc-si/language/control-structures.xml:1.2 Sun Sep 1 16:43:42 2002
+++ phpdoc-si/language/control-structures.xml Mon Sep 2 10:15:57 2002
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
-<!-- $EN-Revision: 1.63 Maintainer: dejan Status: ready -->
+<!-- $Revision: 1.3 $ -->
+<!-- $EN-Revision: 1.63 Maintainer: dejan Status: working -->
<chapter id="control-structures">
<title>Kontrolne strukture</title>
@@ -312,13 +312,7 @@
dovoljuje ustavljanje izvajanja v sredini blokov kode, z enkapsulacijo
le-teh v <literal>do..while</literal>(0) in uporabo <link
linkend="control-structures.break"><literal>break</literal></link>
- stavka.
- Advanced C users may be familiar with a different usage of the
- <literal>do..while</literal> loop, to allow stopping execution in
- the middle of code blocks, by encapsulating them with
- <literal>do..while</literal>(0), and using the <link
- linkend="control-structures.break"><literal>break</literal></link>
- statement. Naslednji primer to demonstrira:
+ stavka. Naslednji primer to demonstrira:
<informalexample>
<programlisting role="php">
<![CDATA[
@@ -365,7 +359,7 @@
enkrat - na začetku zanke.
</simpara>
<simpara>
- V začetku vsakega nadaljevanja, je preverjena vrednost izraza
+ Na začetku vsakega nadaljevanja, je preverjena vrednost izraza
<replaceable>izraz2</replaceable>. Če je vrednost izraza &true;
se zanka nadaljuje in stavek oziroma stavki se izvedejo. Če je
vrednost izraza &false; se izvajanje zanke kon&269;a.
@@ -506,7 +500,7 @@
</para>
</note>
<para>
- Verjetno ste opazili, da so naslednji primeri funkcijonalno enaki:
+ Verjetno ste opazili, da so naslednji primeri funkcionalno enaki:
<informalexample>
<programlisting role="php">
<![CDATA[
@@ -521,7 +515,7 @@
]]>
</programlisting>
</informalexample>
- Tudi naslednji primeri so funkcijonalno enaki:
+ Tudi naslednji primeri so funkcionalno enaki:
<informalexample>
<programlisting role="php">
<![CDATA[
@@ -754,25 +748,24 @@
</informalexample>
</para>
<simpara>
- Here, if $i equals to 0, PHP would execute all of the print
- statements! If $i equals to 1, PHP would execute the last two
- print statements, and only if $i equals to 2, you'd get the
- 'expected' behavior and only 'i equals 2' would be displayed. So,
- it's important not to forget <literal>break</literal> statements
- (even though you may want to avoid supplying them on purpose under
- certain circumstances).
- </simpara>
- <simpara>
- In a <literal>switch</literal> statement, the condition is
- evaluated only once and the result is compared to each
- <literal>case</literal> statement. In an <literal>elseif</literal>
- statement, the condition is evaluated again. If your condition is
- more complicated than a simple compare and/or is in a tight loop,
- a <literal>switch</literal> may be faster.
+ V tem primeru, če je $i enak 0, bi PHP izvedel vse print
+ stavke, in samo v primeru, da bi $i bil enak 2, bi dobili
+ 'pričakovan' rezultat, ki bi izpisal samo 'i equals 2'.
+ Torej, pomembno je, da ne pozabite <literal>break</literal>
+ stavkov (čeprav je spuščanje le-teh v določenih
+ primerih zaželjeno).
+ </simpara>
+ <simpara>
+ V <literal>switch</literal> stavku, je vrednost izraza preverjena
+ samo enkrat in njegov rezultat je primerjan z vsakim
+ <literal>case</literal> izrazom. V <literal>elseif/<literal>
+ stavku je vrednost pogoja ponovno preverjena. Če je pogoj
+ bolj zahteven kot enostavno primerjanje dveh vrednosti, bo
+ <literal>switch</literal> stavek verjetno hitrejši.
</simpara>
<para>
- The statement list for a case can also be empty, which simply
- passes control into the statement list for the next case.
+ Če <literal>case</literal> ne vsebuje stavkov, se enostavno
+ nadaljuje izvajanje naslednjega <literal>case</literal> izraza.
<informalexample>
<programlisting role="php">
<![CDATA[
@@ -790,9 +783,9 @@
</informalexample>
</para>
<para>
- A special case is the default case. This case matches anything
- that wasn't matched by the other cases, and should be the last
- <literal>case</literal> statement. For example:
+ Poseben primer <literal>case</literal> izraza je <literal>default</literal>
+ case. Ta izraz bo pobral vse vrednosti, ki niso veljale za ostale
+ <literal>case</literal> izraze in bi moral biti podan zadnji. Primer:
<informalexample>
<programlisting role="php">
<![CDATA[
@@ -814,16 +807,16 @@
</informalexample>
</para>
<para>
- The <literal>case</literal> expression may be any expression that
- evaluates to a simple type, that is, integer or floating-point
- numbers and strings. Arrays or objects cannot be used here unless
- they are dereferenced to a simple type.
+ <literal>Case</literal> izraz je lahko izraz, ki vrne neko enostavno
+ vrednost oziroma enostaven tip spremenljivlje, kot naprimer integer ali
+ floating-point, številke ali nizi. Polja ali objekti so lahko uporabljeni
+ samo kadar so spremenjeni v enostavne tipe spremenljivk.
</para>
<para>
- The alternative syntax for control structures is supported with
- switches. For more information, see <link
- linkend="control-structures.alternative-syntax">Alternative syntax
- for control structures</link> .
+ <literal>Switch</literal> stavki podpirajo tudi alternativno sintakso.
+ Za več informacij si poglejte <link
+ linkend="control-structures.alternative-syntax">Alternativna sintaksa
+ za kontrolne strukture</link> .
<informalexample>
<programlisting role="php">
<![CDATA[
@@ -849,50 +842,46 @@
<sect1 id="control-structures.declare">
<title><literal>declare</literal></title>
<para>
- The <literal>declare</literal> construct is used to
- set execution directives for a block of code.
- The syntax of <literal>declare</literal> is similar to
- the syntax of other flow control constructs:
+ <literal>Declare</literal> stavek je uporabljen za izvajanje
+ direktiv za nek blok kode. Sintaksa <literal>declare</literal>
+ stavka je podobna drugim kontrolnim strukturam za potek
+ programa:
<informalexample>
<programlisting>
<![CDATA[
-declare (directive) statement
+declare (direktiva) stavek
]]>
</programlisting>
</informalexample>
</para>
<para>
- The <literal>directive</literal> section allows the
- behavior of the <literal>declare</literal> block to
- be set.
- Currently only one directive is recognized: the
- <literal>ticks</literal> directive. (See below for more
- information on the
- <link linkend="control-structures.declare.ticks">ticks</link>
- directive)
+ Z <literal>direktiva</literal> določimo obnašanje
+ <literal>declare</literal> bloka.
+ Trenutno je prepoznana samo ena direktiva:
+ <literal>ticks</literal> direktiva. (Poglejte spodaj
+ za več informacij o <link
+ linkend="control-structures.declare.ticks">ticks</link>
+ direktivi.
</para>
<para>
- The <literal>statement</literal> part of the
- <literal>declare</literal> block will be executed - how
- it is executed and what side-effects occur during execution
- may depend on the directive set in the
- <literal>directive</literal> block.
+ <literal>Stavek</literal> <literal>declare</literal> bloka
+ bo izveden - kako pa bo izveden in kaj se bo zgodilo, je pa
+ določeno s podano direktivo.
</para>
<sect2 id="control-structures.declare.ticks">
<title>Ticks</title>
- <para>A tick is an event that occurs for every
- <replaceable>N</replaceable> low-level statements executed
- by the parser within the <literal>declare</literal> block.
- The value for <replaceable>N</replaceable> is specified
- using <literal>ticks=<replaceable>N</replaceable></literal>
- within the <literal>declare</literal> blocks's
- <literal>directive</literal> section.
+ <para>Tick je dogodek, ki se zgodi vsak
+ <replaceable>N</replaceable> stavek, ki je izveden v
+ <literal>declare</literal> bloku. Vrednost
+ <replaceable>N</replaceable> je določena z uporabo
+ <literal>ticks=<replaceable>N</replaceable></literal> v
+ <literal>direktivi</literal> <literal>declare</literal> bloka.
</para>
<para>
- The event(s) that occurs on each tick is specified using the
- <function>register_tick_function</function>. See the example
- below for more details. Note that more than one event can occur
- for each tick.
+ Dogodek oziroma dogodki, ki se zgodijo ob vsakem 'tick'-u, je
+ določen z <function>register_tick_function</function>.
+ Poglejte si primer spodaj za vec informacij. Zapomnite si, da se
+ lahko zgodi tudi več dogodkov za en tick.
</para>
<para>
<example>
@@ -956,39 +945,37 @@
<sect1 id="function.return">
<title>return</title>
<simpara>
- If called from within a function, the <function>return</function>
- statement immediately ends execution of the current function, and
- returns its argument as the value of the function
- call. <function>return</function> will also end the execution of
- an <function>eval</function> statement or script file.
- </simpara>
- <simpara>
- If called from the global scope, then execution of the current
- script file is ended. If the current script file was
- <function>include</function>ed or <function>require</function>ed,
- then control is passed back to the calling file. Furthermore, if
- the current script file was <function>include</function>ed, then
- the value given to <function>return</function> will be returned as
- the value of the <function>include</function> call. If
- <function>return</function> is called from within the main script
- file, then script execution ends. If the current script file was
- named by the <link
- linkend="ini.auto-prepend-file">auto_prepend_file</link> or <link
+ Če funkcijo <function>return</function> kličemo iz neke
+ funkcije, se ta takoj konča in vrne argument kot vrednost
+ funkcije. <function>return</function> bo končal tudi izvajanje
+ <function>eval</function> funkcije ali skriptne datoteke.
+ </simpara>
+ <simpara>
+ Če funkcijo <function>return</function> kličemo v
+ globalnem dosegu, se izvajanje trenutne skripte konča.
+ Če je bila trenutna skripta klicana s funkcijo
+ <function>include</function> ali <function>require</function> se
+ izvajanje nadaljuje v klicujoči skripti. Poleg tega, če
+ je trenutna skriptna datoteka bila klicana s funkcijo
+ <function>include</function>, bo vrednost <function>return</function>
+ argumenta vrnjena kot vrednost <function>include</function>
+ funkcije. Če je funkcija <function>return</function>
+ klicana v glavni skriptni datoteki, se izvajanje skripte
+ konča. Če je bila trenutna skripta klicana z
+ konfiguracijskimi opcijami <link
+ linkend="ini.auto-prepend-file">auto_prepend_file</link> ali <link
linkend="ini.auto-append-file">auto_append_file</link>
- configuration options in <link linkend="configuration.file">the
- configuration file</link>, then that script file's execution is
- ended.
+ v <link linkend="configuration.file">konfiguracijski
+ datoteki</link>, se le-ta skripta konča.
</simpara>
- <simpara>For more information, see <link
+ <simpara>Za več informacij si poglejte <link
linkend="functions.returning-values">Returning values</link>.
</simpara>
<note>
<simpara>
- Note that since <function>return</function> is a language
- construct and not a function, the parentheses surrounding its
- arguments are <emphasis>not</emphasis> required--in fact, it is
- more common to leave them out than to use them, although it
- doesn't matter one way or the other.
+ Zapomnite si, ker <function>return</function> ni prava funkcija,
+ temveč je del PHP jezika, oklepaji okoli argumenta niso
+ potrebni--a to ne vpliva na delovanje te funkcije.
</simpara>
</note>
</sect1>
@@ -998,29 +985,29 @@
<title><function>require</function></title>
<simpara>
- The <function>require</function> statement includes and evaluates
- the specific file.
+ Funkcija <function>require</function> vključi in preveri
+ podano datoteko.
</simpara>
<simpara>
- <function>require</function> includes and evaluates a specific file.
- Detailed information on how this inclusion works is described in the
- documentation for <function>include</function>.
- </simpara>
- <simpara>
- <function>require</function> and <function>include</function>
- are identical in every way except how they handle failure.
- <function>include</function> produces a
- <link linkend="internal.e-warning">Warning</link> while
- <function>require</function> results in a <link linkend="internal.e-error">
- Fatal Error</link>. In other words, don't hesitate to use
- <function>require</function> if you want a missing file to halt processing
- of the page. <function>include</function> does not behave this way, the
- script will continue regardless. Be sure to have an appropriate
- <link linkend="ini.include-path">include_path</link> setting as well.
+ Funkcija <function>require</function> vključi in preveri
+ podano datoteko. Bolj podrobne informacije o delovanju te funkcije so
+ opisane v dokumentaciji funkcije <function>include</function>.
+ </simpara>
+ <simpara>
+ Funkcije <function>require</function> in <function>include</function>
+ se razlikejta samo po tem, kako ravnata z napakami.
+ Funkcija <function>include</function> izpiše <link
+ linkend="internal.e-warning">Opozorilo</link>, medtem ko
+ funkcija <function>require</function> povzoroči <link
+ linkend="internal.e-error">Usodno napako</link>. Vedno uporabite
+ funkcijo <function>require</function>, če bi radi zaradi manjkajoče
+ datoteke radi ustavili izvajanje skripte. Funkcija <function>include</function>
+ v tem primeru, ne bo ustavila delovanja skripte. Bodite pozorni tudi na
+ <link linkend="ini.include-path">include_path</link> nastavitev.
</simpara>
<para>
<example>
- <title>Basic <function>require</function> examples</title>
+ <title>Osnovni <function>require</function> primeri</title>
<programlisting role="php">
<![CDATA[
<?php
@@ -1037,56 +1024,56 @@
</example>
</para>
<simpara>
- See the <function>include</function> documentation for more examples.
+ Poglejte si <function>include</function> dokumentacijo za vec primerov.
</simpara>
<note>
<simpara>
- Prior to PHP 4.0.2, the following applies: <function>require</function> will
- always attempt to read the target file, even if the line it's on never executes.
- The conditional statement won't affect <function>require</function>. However,
- if the line on which the <function>require</function> occurs is not executed,
- neither will any of the code in the target file be executed. Similarly, looping
- structures do not affect the behaviour of <function>require</function>. Although
- the code contained in the target file is still subject to the loop, the
- <function>require</function> itself happens only once.
+ Za verzije PHP starejše od 4.0.2 velja naslednje: funkcija
+ <function>require</function> bo vedno skušala prebrati ciljno
+ datoteko tudi če se vrstica, na kateri je, ne bo nikoli izvedla.
+ Vseeno pa velja da, če se vrstica v kateri je funkcija
+ <function>require</function> ne izvede, se tudi morebitna koda ne
+ izvede v tej datoteki. Čeprav se koda lahko izvaja kot zanka, se bo
+ funkcija <function>require</function> izvedla samo enkrat.
</simpara>
</note>
&warn.no-win32-fopen-wrapper;
<simpara>
- See also <function>include</function>, <function>require_once</function>,
+ Poglejte si tudi <function>include</function>, <function>require_once</function>,
<function>include_once</function>, <function>eval</function>,
<function>file</function>, <function>readfile</function>,
- <function>virtual</function> and <link linkend="ini.include-path">include_path</link>.
+ <function>virtual</function> in <link linkend="ini.include-path">include_path</link>.
</simpara>
</sect1>
<sect1 id="function.include">
<title><function>include</function></title>
<simpara>
- The <function>include</function> statement includes and evaluates
- the specified file.
+ <function>include</function> funkcija vključi in preveri podano
+ datoteko.
</simpara>
<simpara>
- The documentation below also applies to <function>require</function>.
- The two constructs are identical in every way except how they handle
- failure. <function>include</function> produces a
- <link linkend="internal.e-warning">Warning</link> while <function>require</function>
- results in a <link linkend="internal.e-error">Fatal Error</link>.
- In other words, use <function>require</function> if you want
- a missing file to halt processing of the page. <function>include</function> does
- not behave this way, the script will continue regardless. Be sure to have an
- appropriate <link linkend="ini.include-path">include_path</link> setting as well.
- </simpara>
- <simpara>
- When a file is included, the code it contains inherits the
- <link linkend="language.variables.scope">variable scope</link> of the
- line on which the include occurs. Any variables available at that line
- in the calling file will be available within the called file, from that
- point forward.
+ Naslednja dokumentacija velja tudi za funkcijo <function>require</function>.
+ Ti dve funckiji se razlikujeta samo po tem, kako ravnata ob napakki.
+ Funkcija <function>include</function> izpiše <link
+ linkend="internal.e-warning">Opozorilo</link>, medtem ko
+ funkcija <function>require</function> povzoroči <link
+ linkend="internal.e-error">Usodno napako</link>. Vedno uporabite
+ funkcijo <function>require</function>, če bi radi zaradi manjkajoče
+ datoteke radi ustavili izvajanje skripte. Funkcija <function>include</function>
+ v tem primeru, ne bo ustavila delovanja skripte. Bodite pozorni tudi na
+ <link linkend="ini.include-path">include_path</link> nastavitev.
+ </simpara>
+ <simpara>
+ Ko se datoteka vključi, je tej datoteki navoljo <link
+ linkend="language.variables.scope">območje spremenljivk</link>
+ klicujoče datoteke do te vrstice. Vse spremenljivke, ki so na
+ voljo do te vrstice, bodo na voljo tudi v klicani datoteki, od te
+ točke naprej.
</simpara>
<para>
<example>
- <title>Basic <function>include</function> example</title>
+ <title>Osnovni <function>include</function> primeri</title>
<programlisting role="php">
<![CDATA[
vars.php
@@ -1112,10 +1099,10 @@
</example>
</para>
<simpara>
- If the include occurs inside a function within the calling file,
- then all of the code contained in the called file will behave as
- though it had been defined inside that function. So, it will follow
- the variable scope of that function.
+ Če se <literal>include</literal> pojavi v neki funkciji, bodo
+ vse spremenljivke, ki so v klicani datoteki, navoljo samo v tej
+ funkciji. Torej, bodo definirane in na voljo samo v območju
+ spremenljivk te funkcije.
</simpara>
<para>
<example>
@@ -1147,29 +1134,27 @@
</example>
</para>
<simpara>
- When a file is included, parsing drops out of PHP mode and
- into HTML mode at the beginning of the target file, and resumes
- again at the end. For this reason, any code inside the target
- file which should be executed as PHP code must be enclosed within
- <link linkend="language.basic-syntax.phpmode">valid PHP start
- and end tags</link>.
- </simpara>
- <simpara>
- If "<link linkend="ini.allow-url-fopen">URL fopen wrappers</link>"
- are enabled in PHP (which they are in the default configuration),
- you can specify the file to be included using an URL (via HTTP)
- instead of a local pathname. If the target server interprets
- the target file as PHP code, variables may be passed to the included
- file using an URL request string as used with HTTP GET. This is
- not strictly speaking the same thing as including the file and having
- it inherit the parent file's variable scope; the script is actually
- being run on the remote server and the result is then being
- included into the local script.
+ Ko vključimo datoteko, se le-ta obravnava kot navadna
+ HTML dadoteka in če bi želeli znotraj te datoteke
+ izvajati PHP kodo, bi jo morali obdati z <link
+ linkend="language.basic-syntax.phpmode">veljavnimi PHP začetnimi in
+ zaključnimi značkami</link>.
+ </simpara>
+ <simpara>
+ Če imate opcijo "<link
+ linkend="ini.allow-url-fopen">URL fopen wrappers</link>" omogočeno
+ (kar je privzeto) lahko pot do datoteke navedete z uporabo URL naslova
+ (preko HTTP) namesto lokalne poti do datoteke. Če ciljni strežnik
+ interpretira datoteko kot PHP kodo, lahko spremenljivke podamo
+ z HTTP GET metodo. To strogo rečeno ni isto kot vkjučevanje
+ lokalne datoteke, ki teče v klicujočem območju spremenljik;
+ skripta se ubistvu izvaja na oddaljenem strežniku in rezulat te
+ skripte je vključen v lokalno skripto.
</simpara>
&warn.no-win32-fopen-wrapper;
<para>
<example>
- <title><function>include</function> through HTTP</title>
+ <title><function>include</function> preko HTTP</title>
<programlisting role="php">
<![CDATA[
<?php
@@ -1197,18 +1182,17 @@
]]>
</programlisting>
</example>
- See also <link linkend="features.remote-files">Remote files</link>,
- <function>fopen</function> and <function>file</function> for related
- information.
+ Poglejte si tudi <link linkend="features.remote-files">Remote files</link>,
+ <function>fopen</function> and <function>file</function> za sorodne teme.
</para>
<para>
- Because <function>include</function> and <function>require</function>
- are special language constructs, you must enclose them within a statement
- block if it's inside a conditional block.
+ Ker <function>include</function> in <function>require</function> nista pravi
+ funkciji, ampak sta del jezika PHP, jih morate ekapsulirati v zavite
+ oklepaje.
</para>
<para>
<example>
- <title>include() and conditional blocks</title>
+ <title>include() in pogojni stavki</title>
<programlisting role="php">
<![CDATA[
<?php
@@ -1233,6 +1217,9 @@
</example>
</para>
<simpara>
+ Handling Returns: Možna je uporaba <function>return</function> stavka
+ znotraj vključene datoteke, da prekinemo izvajanje te datoteke in se
+ vrnemo nazaj v prejšnjo skripto. Prav tako je mogoče
Handling Returns: It is possible to execute a <function>return</function>
statement inside an included file in order to terminate processing in that
file and return to the script which called it. Also, it's possible to return