[PHP-DOC] cvs: phpdoc-cs /language control-structures.xml
luk Thu May 23 17:07:57 2002 EDT Modified files: /phpdoc-cs/language control-structures.xml Log: Index: phpdoc-cs/language/control-structures.xml diff -u phpdoc-cs/language/control-structures.xml:1.6 phpdoc-cs/language/control-structures.xml:1.7 --- phpdoc-cs/language/control-structures.xml:1.6 Thu May 9 17:15:33 2002 +++ phpdoc-cs/language/control-structures.xml Thu May 23 17:07:57 2002 -1014,73 +1014,75 /example /para simpara -Více pøíkladù -- viz dokumentace functioninclude/function. +Dal¹í pøíklady -- viz dokumentace functioninclude/function. /simpara note simpara - Prior to PHP 4.0.2, the following applies: functionrequire/function will - always attempt to read the target file, even if the line it's on never executes. - The conditional statement won't affect functionrequire/function. However, - if the line on which the functionrequire/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 functionrequire/function. Although - the code contained in the target file is still subject to the loop, the - functionrequire/function itself happens only once. + U verzí pøed PHP 4.0.2 platí toto: functionrequire/function se v¾dy + pokusí pøeèíst pøíslu¹ný soubor, kromì pøípadu, ¾e se øádek s tímto + pøíkazem nemù¾e nikdy provést. Podmínìný výraz + functionrequire/function neovlivòuje. Av¹ak pokud se øádek, na kterém + functionrequire/function le¾í, vùbec neprovádí, nebude se provádìt + ani kód v pøíslu¹ném souboru. Podobnì je tomu i v pøípadì cyklù -- ani + ty neovlivòují chování functionrequire/function. Pøesto¾e kód + obsa¾ený ve vkládaném souboru je stále pøedmìtem opakování, samotné + functionrequire/function se provede pouze jednou. /simpara /note simpara -See also functioninclude/function, functionrequire_once/function, +Viz také functioninclude/function, functionrequire_once/function, functioninclude_once/function, functioneval/function, functionfile/function, functionreadfile/function, -functionvirtual/function and link linkend=ini.include-pathinclude_path/link. +functionvirtual/function a link +linkend=ini.include-pathinclude_path/link. /simpara /sect1 sect1 id=function.include titlefunctioninclude/function/title simpara -The functioninclude/function statement includes and evaluates -the specified file. +Konstrukt functioninclude/function vlo¾í a ohodnotí specifikovaný +soubor. /simpara simpara - The documentation below also applies to functionrequire/function. - The two constructs are identical in every way except how they handle - failure. functioninclude/function produces a - link linkend=internal.e-warningWarning/link while functionrequire/function - results in a link linkend=internal.e-errorFatal Error/link. - In other words, use functionrequire/function if you want - a missing file to halt processing of the page. functioninclude/function does - not behave this way, the script will continue regardless. Be sure to have an - appropriate link linkend=ini.include-pathinclude_path/link setting as well. + Ní¾e popsané platí i pro functionrequire/function. Tyto dva konstrukty + jsou zcela toto¾né, kromì toho, jak zpracovávají chyby. + functioninclude/function produkuje + link linkend=internal.e-warningWarning/link (varování), zatímco + functionrequire/function skonèí s chybou typu + link linkend=internal.e-errorFatal Error/link. + Jinými slovy, functionrequire/function pou¾ijte tehdy, chcete-li, + aby se pøi chybìjícím souboru zastavilo zpracovávání. + functioninclude/function se tak nechová, skript bude neru¹enì + pokraèovat. Ujistìte se také, ¾e máte v poøádku nastavení + link linkend=ini.include-pathinclude_path/link. /simpara simpara - When a file is included, the code it contains inherits the - link linkend=language.variables.scopevariable 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. + Pokud se vlo¾í soubor, potom kód v nìm obsa¾ený dìdí + link linkend=language.variables.scopekontext promìnné/link + øádku, kde byl vlo¾en. V¹echny promìnné dostupné na tomto øádku + volajícího souboru budou (od této chvíle) dostupné i ve volaném souboru. /simpara para example - titleBasic functioninclude/function example/title + titleZákladní pøíklad -- functioninclude/function/title programlisting role=php ![CDATA[ vars.php ?php -$color = 'green'; -$fruit = 'apple'; +$color = 'zelené'; +$fruit = 'jablko'; ? test.php ?php -echo A $color $fruit; // A +echo
[PHP-DOC] cvs: phpdoc-cs /language control-structures.xml
luk Thu May 9 17:15:33 2002 EDT Modified files: /phpdoc-cs/language control-structures.xml Log: Index: phpdoc-cs/language/control-structures.xml diff -u phpdoc-cs/language/control-structures.xml:1.5 phpdoc-cs/language/control-structures.xml:1.6 --- phpdoc-cs/language/control-structures.xml:1.5 Fri Apr 26 16:35:27 2002 +++ phpdoc-cs/language/control-structures.xml Thu May 9 17:15:33 2002 -938,39 +938,34 sect1 id=function.return titlereturn/title simpara -If called from within a function, the functionreturn/function -statement immediately ends execution of the current function, and -returns its argument as the value of the function -call. functionreturn/function will also end the execution of -an functioneval/function statement or script file. +Zavolán uvnitø funkce, konstrukt functionreturn/function okam¾itì +ukonèí provádìní této funkce a vrací svùj argument jako hodnotu volání +funkce. functionreturn/function také obdobnì ukonèí provádìní +konstruktu functioneval/function nebo celého skriptu. /simpara simpara -If called from the global scope, then execution of the current -script file is ended. If the current script file was -functioninclude/functioned or functionrequire/functioned, -then control is passed back to the calling file. Furthermore, if -the current script file was functioninclude/functioned, then -the value given to functionreturn/function will be returned as -the value of the functioninclude/function call. If -functionreturn/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-fileauto_prepend_file/link or link -linkend=ini.auto-append-fileauto_append_file/link -configuration options in link linkend=configuration.filethe -configuration file/link, then that script file's execution is -ended. +Pokud se volá z globálního kontextu, provádìní skriptu se ukonèí. Byl-li +aktuální skript vlo¾en pomocí functioninclude/function nebo +functionrequire/function, pøedá se øízení volajícímu souboru. Navíc, +bylo-li pou¾ito functioninclude/function, bude hodnota specifikovaná +v functionreturn/function vrácena jako hodnota volání +functioninclude/function. Pokud se functionreturn/function +zavolá z hlavního souboru skriptu, provádìní skonèí. Kdy¾ se jedná o +soubor specifikovaný pomocí konfiguraèních voleb +link linkend=ini.auto-prepend-fileauto_prepend_file/link nebo +link linkend=ini.auto-append-fileauto_append_file/link +v link linkend=configuration.filekonfiguraèním souboru/link, +zpracování souboru konèí. /simpara - simparaFor more information, see link - linkend=functions.returning-valuesReturning values/link. + simparaVíce informací - viz + link linkend=functions.returning-valuesNávratové hodnoty/link. /simpara note simpara - Note that since functionreturn/function is a language - construct and not a function, the parentheses surrounding its - arguments are emphasisnot/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. + Uvìdomte si, ¾e functionreturn/function je jazykový konstrukt, a + nikoli funkce -- uzavøení argumentù do závorek emphasisnení/emphasis + nutné. Obvykle se vynechávají, ale nezále¾í na tom, zda se pou¾ijí èi + nikoli. /simpara /note /sect1 -980,29 +975,29 titlefunctionrequire/function/title simpara -The functionrequire/function statement includes and evaluates -the specific file. +Konstrukt functionrequire/function vlo¾í a ohodnotí specifikovaný +soubor. /simpara simpara - functionrequire/function includes and evaluates a specific file. - Detailed information on how this inclusion works is described in the - documentation for functioninclude/function. + functionrequire/function vlo¾í a ohodnotí specifikovaný soubor. + Podrobné informace o tom, jak vkládání pracuje, jsou popsány v + dokumentaci o functioninclude/function. /simpara simpara - functionrequire/function and functioninclude/function - are identical in every way except how they handle failure. - functioninclude/function produces a - link linkend=internal.e-warningWarning/link while - functionrequire/function results in a link linkend=internal.e-error - Fatal Error/link. In other words, don't hesitate to use - functionrequire/function if you want a missing file to halt processing - of the page. functioninclude/function does not behave this way, the - script will continue regardless. Be sure to have an appropriate - link linkend=ini.include-pathinclude_path/link setting as well. + functionrequire/function a
[PHP-DOC] cvs: phpdoc /cs/language control-structures.xml variables.xml
luk Fri Apr 26 16:35:28 2002 EDT Added files: /phpdoc/cs/language variables.xml Modified files: /phpdoc/cs/language control-structures.xml Log: Index: phpdoc/cs/language/control-structures.xml diff -u phpdoc/cs/language/control-structures.xml:1.4 phpdoc/cs/language/control-structures.xml:1.5 --- phpdoc/cs/language/control-structures.xml:1.4 Thu Apr 25 17:58:13 2002 +++ phpdoc/cs/language/control-structures.xml Fri Apr 26 16:35:27 2002 -854,27 +854,25 link linkend=control-structures.declare.ticksticks/link) /para para -The literalstatement/literal part of the -literaldeclare/literal block will be executed - how -it is executed and what side-effects occur during execution -may depend on the directive set in the -literaldirective/literal block. +Èást literalstatement/literal bloku literaldeclare/literal +bude provedena - jak bude provedena a jaké vedlej¹í efekty nastanou +bìhem provádìní mù¾e zále¾et na direktivì nastavené v bloku +literaldirective/literal. /para sect2 id=control-structures.declare.ticks titleTicks/title -paraA tick is an event that occurs for every -replaceableN/replaceable low-level statements executed -by the parser within the literaldeclare/literal block. -The value for replaceableN/replaceable is specified -using literalticks=replaceableN/replaceable/literal -within the literaldeclare/literal blocks's -literaldirective/literal section. +paraTick je událost, která nastane pro ka¾dých +replaceableN/replaceable nízkoúrovòových konstruktù provedených +parserem uvnitø bloku literaldeclare/literal. Hodnota +replaceableN/replaceable je specifikována pomocí +literalticks=replaceableN/replaceable/literal uvnitø sekce +literaldirective/literal bloku literaldeclare/literal. /para para -The event(s) that occurs on each tick is specified using the -functionregister_tick_function/function. See the example -below for more details. Note that more than one event can occur -for each tick. +Událost(i), která nastane pøi ka¾dém ticku, se specifikuje pomocí +functionregister_tick_function/function. Více podrobností - viz +pøíklad ní¾e. Uvìdomte si, ¾e na ka¾dý tick mù¾e nastat více ne¾ jedna +událost. /para para example Index: phpdoc/cs/language/variables.xml +++ phpdoc/cs/language/variables.xml ?xml version=1.0 encoding=iso-8859-2? !-- EN-Revision: 1.45 Maintainer: luk Status: mixed -- chapter id=language.variables titlePromìnné/title sect1 id=language.variables.basics titleZáklady/title simpara Promìnné jsou v PHP reprezentovány znakem dolaru, následovaným názvem pøíslu¹né promìnné. V názvech promìnných se rozli¹uje velikost písmen. /simpara para Názvy promìnných jsou podøízeny stejným pravidlùm jako jiná návì¹tí v PHP. Platný název promìnné zaèíná písmenem nebo podtr¾ítkem, následovaným libovolným poètem písmen, èíslic nebo potr¾ítek. Jako regulární výraz to lze zapsat takto: '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' /para note simpara Pro na¹e úèely zde budeme za písmena pova¾ovat znaky a-z, A-Z a ASCII znaky od 127 do 255 (0x7f-0xff). /simpara /note para informalexample programlisting role=php ![CDATA[ $var = Bob; $Var = Joe; echo $var, $Var; // vypí¹e Bob, Joe $4site = 'not yet'; // neplatné; zaèíná èíslicí $_4site = 'not yet';// platné; zaèíná podtr¾ítkem $täyte = 'mansikka';// platné; 'ä' je ASCII 228. ]] /programlisting /informalexample /para para V PHP 3 mají promìnné v¾dy pøiøazenu hodnotu. To znamená, ¾e kdy¾ pøiøadíte výraz do promìnné, celá hodnota pùvodního výrazu se zkopíruje do cílové promìnné. Tedy, napøíklad, po pøiøazení hodnoty jedné promìnné do druhé, zmìna jedné z nich se na druhé neprojeví. Více informací o tomto zpùsobu pøiøazení viz link linkend=language.expressionsVýrazy/link. /para para PHP nabízí jiný zpùsob pøiøazení hodnot promìnným: emphasispøiøazení odkazu/emphasis. To znamená, ¾e nová promìnná jednodu¹e odkazuje (jinými slovy, stává se aliasem nebo ukazuje na) na pùvodní promìnnou. Zmìny na nové promìnné se projeví na té pùvodní a naopak. To také znamená, ¾e se nic nekopíruje; proto je pøiøazení rychlej¹í. Av¹ak toto zrychlení bude zjistitelné pouze v tìsných cyklech nebo pøi pøiøazování velkých polí èi objektù. /para para Pro pøiøazení odkazu staèí jednodu¹e pøed promìnnou, která bude pøiøazována (zdrojová promìnná), pøedøadit ampersand (amp;). Napøíklad následující kus kódu vypí¹e dvakrát 'Jmenuji se Bob': informalexample programlisting role=php ![CDATA[ ?php $foo = 'Bob'; // Pøiøadí hodnotu 'Bob' do $foo $bar = $foo; // Odkaz $foo pøes $bar. $bar = Jmenuji se $bar; // Zmìna $bar...
[PHP-DOC] cvs: phpdoc /cs/language control-structures.xml
luk Thu Apr 4 14:55:40 2002 EDT Modified files: /phpdoc/cs/language control-structures.xml Log: Index: phpdoc/cs/language/control-structures.xml diff -u phpdoc/cs/language/control-structures.xml:1.2 phpdoc/cs/language/control-structures.xml:1.3 --- phpdoc/cs/language/control-structures.xml:1.2 Thu Mar 28 18:17:48 2002 +++ phpdoc/cs/language/control-structures.xml Thu Apr 4 14:55:40 2002 -237,10 +237,9 vnoøený kód se neprovede vùbec. /simpara para -Like with the literalif/literal statement, you can group -multiple statements within the same literalwhile/literal loop -by surrounding a group of statements with curly braces, or by -using the alternate syntax: +Podobnì, jako v pøípadì literalif/literal, mù¾ete i zde seskupovat +konstrukty uvnitø cyklu literalwhile/literal ohranièením tohoto +kódu slo¾enými závorkami nebo za pou¾ití alternativní syntaxe: informalexample programlisting ![CDATA[ -250,21 +249,20 /informalexample /para para -The following examples are identical, and both print numbers from -1 to 10: +Následující pøíklady jsou identické, oba vypí¹í èísla od 1 do 10: informalexample programlisting role=php ![CDATA[ -/* example 1 */ +/* pøíklad 1 */ $i = 1; while ($i = 10) { -print $i++; /* the printed value would be -$i before the increment -(post-increment) */ +print $i++; /* vyti¹tìná hodnota by byla rovna +$i pøed inkrementací +(post-inkrementace) */ } -/* example 2 */ +/* pøíklad 2 */ $i = 1; while ($i = 10): -280,20 +278,17 sect1 id=control-structures.do.while titleliteraldo..while/literal/title simpara -literaldo..while/literal loops are very similar to -literalwhile/literal loops, except the truth expression is -checked at the end of each iteration instead of in the beginning. -The main difference from regular literalwhile/literal loops is -that the first iteration of a literaldo..while/literal loop is -guaranteed to run (the truth expression is only checked at the end -of the iteration), whereas it's may not necessarily run with a -regular literalwhile/literal loop (the truth expression is -checked at the beginning of each iteration, if it evaluates to -false; right from the beginning, the loop -execution would end immediately). +Cykly literaldo..while/literal jsou velmi podobné cyklùm +literalwhile/literal kromì toho, ¾e pravdivost výrazu se testuje +na konci ka¾dé iterace namísto jejího zaèátku. Hlavní rozdíl oproti +bì¾ným cyklùm literalwhile/literal je ten, ¾e první iterace cyklu +literaldo..while/literal se provede v¾dy (pravdivostní výraz je +testován a¾ na konci iterace), co¾ u cyklu literalwhile/literal +není zaruèeno (pravdivostní výraz je testován na zaèátku iterace; pokud +je ohodnocen jako false;, provádìní cyklu hned skonèí). /simpara para -There is just one syntax for literaldo..while/literal loops: +Toto je jediná syntaxe pro cykly literaldo..while/literal: informalexample programlisting role=php -307,33 +302,32 /informalexample /para simpara - The above loop would run one time exactly, since after the first - iteration, when truth expression is checked, it evaluates to - false; ($i is not bigger than 0) and the loop - execution ends. + Vý¹e uvedený cyklus by se provedl právì jednou, proto¾e po první iteraci, + kdy¾ se testuje pravdivostní výraz, je tento ohodnocen jako false; + ($i není vìt¹í ne¾ 0) a provádìní cyklu konèí. /simpara para -Advanced C users may be familiar with a different usage of the -literaldo..while/literal loop, to allow stopping execution in -the middle of code blocks, by encapsulating them with -literaldo..while/literal(0), and using the link -linkend=control-structures.breakliteralbreak/literal/link -statement. The following code fragment demonstrates this: +Pokroèilí programátoøi v C mohou znát i odli¹né pou¾ití cyklu +literaldo..while/literal. Kód se uzavøe do +literaldo..while/literal(0) a pou¾ije se pøíkaz +link linkend=control-structures.breakliteralbreak/literal/link. +To umo¾òuje pøeru¹it provádìní cyklu uprostøed kódu, jak je znázornìno +v tomto pøíkladu: informalexample programlisting role=php ![CDATA[ do { if ($i 5) { -print i is not big enough; +print i není dost velké; break; } $i *= $factor; if ($i $minimum_limit) { break; } -print i is ok; +print i je ok; - ...process i... + ...zpracuj i... } while(0); ]] -341,18 +335,17 /informalexample /para simpara -Don't worry if you don't understand this right away or at all. -You can code scripts and even powerful scripts
[PHP-DOC] cvs: phpdoc /cs/language control-structures.xml
luk Thu Mar 28 18:17:48 2002 EDT Modified files: /phpdoc/cs/language control-structures.xml Log: Index: phpdoc/cs/language/control-structures.xml diff -u phpdoc/cs/language/control-structures.xml:1.1 phpdoc/cs/language/control-structures.xml:1.2 --- phpdoc/cs/language/control-structures.xml:1.1 Mon Mar 25 18:07:15 2002 +++ phpdoc/cs/language/control-structures.xml Thu Mar 28 18:17:48 2002 -178,44 +178,45 /informalexample /para simpara -In the above example, the HTML block A = 5 is nested within an -literalif/literal statement written in the alternative syntax. -The HTML block would be displayed only if $a is equal to 5. +Ve vý¹e uvedeném pøíkladu je HTML blok vnoøen do konstruktu +literalif/literal napsaném alternativní syntaxí. +Tento HTML blok by se zobrazil pouze v pøípadì, ¾e je $a rovno 5. /simpara para -The alternative syntax applies to literalelse/literal and -literalelseif/literal as well. The following is an -literalif/literal structure with literalelseif/literal and -literalelse/literal in the alternative format: +Alternativní syntaxi lze pou¾ít i pro literalelse/literal a +literalelseif/literal. Následující pøíklad ukazuje strukturu +literalif/literal, literalelseif/literal a +literalelse/literal v alternativním formátu: informalexample programlisting role=php ![CDATA[ if ($a == 5): -print a equals 5; +print a se rovná 5; print ...; elseif ($a == 6): -print a equals 6; +print a se rovná 6; print !!!; else: -print a is neither 5 nor 6; +print a není ani 5, ani 6; endif; ]] /programlisting /informalexample /para para -See also link linkend=control-structures.whilewhile/link, -link linkend=control-structures.forfor/link, and link -linkend=control-structures.ifif/link for further examples. +Dal¹í pøíklady - viz také +link linkend=control-structures.whilewhile/link, +link linkend=control-structures.forfor/link, a link +linkend=control-structures.ifif/link. /para /sect1 sect1 id=control-structures.while titleliteralwhile/literal/title para -literalwhile/literal loops are the simplest type of loop in -PHP. They behave just like their C counterparts. The basic form -of a literalwhile/literal statement is: +Cykly literalwhile/literal jsou nejjednodu¹¹ím typem cyklù v PHP. +Chovají se jako jejich protìj¹ci v C. Základí formát konstruktu +literalwhile/literal je tento: informalexample programlisting ![CDATA[ -225,17 +226,15 /informalexample /para simpara -The meaning of a literalwhile/literal statement is simple. It -tells PHP to execute the nested statement(s) repeatedly, as long -as the literalwhile/literal expression evaluates to -true;. The value of the expression is checked -each time at the beginning of the loop, so even if this value -changes during the execution of the nested statement(s), execution -will not stop until the end of the iteration (each time PHP runs -the statements in the loop is one iteration). Sometimes, if the -literalwhile/literal expression evaluates to -false; from the very beginning, the nested -statement(s) won't even be run once. +Význam konstruktu literalwhile/literal je snadno pochopitelný. +Øíká PHP, ¾e má provádìt vnoøený(é) konstrukt(y) tak dlouho, dokud je +výraz ve literalwhile/literal roven true;. Hodnota výrazu je testována +poka¾dé na zaèátku cyklu (v ka¾dé iteraci), tak¾e i kdy¾ se tato hodnota +bìhem provádìní vnoøených konstruktù zmìní, provede se zbytek kódu uvnitø +cyklu - v konkrétní iteraci - a¾ do konce (ka¾dé provedení kódu uvnitø +cyklu je jedna iterace). Nìkdy, kdy¾ je výraz ve +literalwhile/literal ohodnocen jako false; ji¾ pøi vstupu do cyklu, +vnoøený kód se neprovede vùbec. /simpara para Like with the literalif/literal statement, you can group