コード例 #1
0
ファイル: scope1.php プロジェクト: rex786/php2js
            $arg = 'foo';
        }
        return $arg;
    }
    $result = t11('hey');
    echo "Test that variable in function parameter list can be redefined after unary op.<br>\n";
    echo 'result: ' . ($result == 'foo' ? 'pass' : 'fail') . "<br><br>\n\n";
}
function test12()
{
    function t11($arg)
    {
        $arg /= 3;
        return $arg;
    }
    $result = t11(12);
    echo "Test that variable in function parameter does not get redeclared with 'var '<br>\n";
    echo 'result: ' . ($result == 4 ? 'pass' : 'fail') . "<br><br>\n\n";
}
test1();
test2();
test3();
test4();
test5();
test6();
test7();
test8();
test9();
test10();
test11();
test12();
コード例 #2
0
$barge = false;
$barge |= test7(array("Retriever", "Strip Miner I", "Mining Laser Upgrade I"), "a Retriever");
$barge |= test7(array("Procurer", "Strip Miner I", "Mining Laser Upgrade I"), "a Procurer");
$barge |= test7(array("Covetor", "Strip Miner I", "Mining Laser Upgrade I"), "a Covetor");
if ($barge) {
    echo "<br>\n";
}
if (!$barge && !$exhumer) {
    echo "<br>can't use any mining ships<br>\n";
} elseif (!$exhumer && $barge) {
    echo "<br>can't use any exhumers<br>\n";
} elseif ($exhumer && !$barge) {
    echo "<br>can't use any mining barges<br>\n";
}
echo "<br>\n";
// Capitals
echo "<center> Capitals</center>";
$capital = false;
$capital |= test7(array("Orca", "Mining Foreman Link - Harvester Capacitor Efficiency I", "Small Tractor Beam I", "Expanded Cargohold II"), "a Orca");
$capital |= test7(array("Moros", "Capital Armor Repairer I", "Dual 1000mm Railgun I", "Siege Module I"), "a moros");
$capital |= test7(array("Revelation", "Capital Armor Repairer I", "Dual Giga Beam Laser I", "Siege Module I"), "a revelation");
$capital |= test7(array("Naglfar", "Capital Shield Booster I", "Quad 3500mm Siege Artillery I", "Siege Module I"), "a naglfar");
$capital |= test7(array("Phoenix", "Capital Shield Booster I", "Citadel Cruise Launcher I", "Siege Module I"), "a phoenix");
$capital |= test7(array("Thanatos", "Capital Armor Repairer I", "Fighters"), "a thanatos", $SkillsApi->canCharUseTypeNames(array("Capital Remote Armor Repair System I", "Capital Remote Shield Booster I")) ? "well" : "poorly");
$capital |= test7(array("Archon", "Capital Armor Repairer I", "Fighters"), "an archon", $SkillsApi->canCharUseTypeNames(array("Capital Remote Armor Repair System I", "Capital Energy Transfer Array I")) ? "well" : "poorly");
$capital |= test7(array("Nidhoggur", "Capital Armor Repairer I", "Fighters"), "a nidhoggur", $SkillsApi->canCharUseTypeNames(array("Capital Remote Armor Repair System I", "Capital Remote Shield Booster I")) ? "well" : "poorly");
$capital |= test7(array("Chimera", "Capital Shield Booster I", "Bouncer I", "Fighters"), "a chimera", $SkillsApi->canCharUseTypeNames(array("Capital Energy Transfer Array I", "Capital Remote Shield Booster I")) ? "well" : "poorly");
if (!$capital) {
    echo "<br>can't use any capitals<br>\n";
}
echo "</span>";