PHP Classes

File: zray/vendor/PHP_CodeSniffer-2.2.0/CodeSniffer/Standards/Squiz/Docs/ControlStructures/ForEachLoopDeclarationStandard.xml

Recommend this page to a friend!
  Classes of Simo  >  CodeIgniter Plugin for Z-Ray  >  zray/vendor/PHP_CodeSniffer-2.2.0/CodeSniffer/Standards/Squiz/Docs/ControlStructures/ForEachLoopDeclarationStandard.xml  >  Download  
File: zray/vendor/PHP_CodeSniffer-2.2.0/CodeSniffer/Standards/Squiz/Docs/ControlStructures/ForEachLoopDeclarationStandard.xml
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: CodeIgniter Plugin for Z-Ray
Show CodeIgniter application information in Z-Ray
Author: By
Last change:
Date: 3 months ago
Size: 1,009 bytes
 

Contents

Class file image Download
<documentation title="Foreach Loop Declarations">
    <standard>
    <![CDATA[
    There should be a space between each element of a foreach loop and the as keyword should be lowercase.
    ]]>
    </standard>
    <code_comparison>
        <code title="Valid: Correct spacing used.">
        <![CDATA[
foreach (<em></em>$foo<em> </em>as<em> </em>$bar<em> </em>=><em> </em>$baz<em></em>) {
    echo $baz;
}
]]>
        </code>
        <code title="Invalid: Invalid spacing used.">
        <![CDATA[
foreach (<em> </em>$foo<em>  </em>as<em>  </em>$bar<em></em>=><em></em>$baz<em> </em>) {
    echo $baz;
}
]]>
        </code>
    </code_comparison>
    <code_comparison>
        <code title="Valid: Lowercase as keyword.">
        <![CDATA[
foreach ($foo <em>as</em> $bar => $baz) {
    echo $baz;
}
]]>
        </code>
        <code title="Invalid: Uppercase as keyword.">
        <![CDATA[
foreach ($foo <em>AS</em> $bar => $baz) {
    echo $baz;
}
]]>
        </code>
    </code_comparison>
</documentation>
For more information send a message to info at phpclasses dot org.