svn: /phpdoc/zh/trunk/language/control-structures/ goto.xml

From: Date: Thu, 24 Sep 2009 03:45:01 +0000
Subject: svn: /phpdoc/zh/trunk/language/control-structures/ goto.xml
Groups: php.doc.zh 
Request: Send a blank email to doc-zh+get-3202@lists.php.net to get a copy of this message
haohappy Thu, 24 Sep 2009 03:45:01 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=288636 Log: Translated the "goto" section Changed paths: U phpdoc/zh/trunk/language/control-structures/goto.xml Modified: phpdoc/zh/trunk/language/control-structures/goto.xml =================================================================== --- phpdoc/zh/trunk/language/control-structures/goto.xml 2009-09-24 03:35:17 UTC (rev 288635) +++ phpdoc/zh/trunk/language/control-structures/goto.xml 2009-09-24 03:45:01 UTC (rev 288636) @@ -1,23 +1,20 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- $Revision: 283798 $ --> +<!-- $Revision: 283934 $ --> +<!-- $Author: haohappy $ --> +<!-- EN-Revision: 283798 Maintainer: haohappy Status: ready --> <sect1 xml:id="control-structures.goto" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <title><literal>goto</literal></title> <para> - The <literal>goto</literal> operator can be used to jump to another - section in the program. The target point is specified by a label - followed by a colon, and the instruction is given as - <literal>goto</literal> followed by the desired target label. This - is not a full unrestricted <literal>goto</literal>. The target - label must be within the same file and context, meaning that you cannot jump - out of a function or method, nor can you jump into one. You also - cannot jump into any sort of loop or switch structure. You may jump - out of these, and a common use is to use a <literal>goto</literal> - in place of a multi-level <literal>break</literal>. + <literal>goto</literal>操作符可以用来跳转到程序中的某一指定位置。该目标位置可以用目标名称 +加上冒号来标记。PHP中的<literal>goto</literal>有一定限制,只能在同一个文件和作用域中跳转, +也就是说你无法跳出一个函数或类方法,也无法跳入到另一个函数。你也无法跳入到任何循环或者switch +结构中。常见的用法是用来跳出循环或者switch,可以代替多层的<literal>break</literal>。 + </para> <para> <example> - <title><literal>goto</literal> example</title> + <title><literal>goto</literal> 示例</title> <programlisting role="php"> <![CDATA[ <?php @@ -39,7 +36,7 @@ </para> <para> <example> - <title><literal>goto</literal> loop example</title> + <title><literal>goto</literal> 跳出循环示例</title> <programlisting role="php"> <![CDATA[ <?php @@ -64,7 +61,7 @@ </para> <para> <example> - <title>This will not work</title> + <title>以下写法无效</title> <programlisting role="php"> <![CDATA[ <?php @@ -89,7 +86,7 @@ </para> <note> <para> - The <literal>goto</literal> operator is available as of PHP 5.3. + The <literal>goto</literal> 操作符仅在 PHP 5.3及以上版本有效. </para> </note> <para>

« previous php.doc.zh (#3202) next »