Exemple #1
0
<?php

class A
{
    function test1(&$farg1)
    {
        $farg1 = 1.5;
    }
}
class B
{
    static function test2(int &$farg2)
    {
    }
}
function test3(&$farg3)
{
}
$a = new A();
$arg1 = [1, 2, 3];
$a->test1($arg1);
B::test2($arg1);
// No errors from undefined vars since they are by-ref
test3($arg3);
preg_match("/(a)/", "a", $match);
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// ****************************************************************************
// (C) ZZJ 5/xx/10
echo "<h4>Misc Skills</h4><hr>";
echo "<table style=\"font-size:88%\">\n";
echo "<tr><td colspan=2><center>Scanning</center></td></tr>";
test3("Astrometrics");
test3("Astrometric Acquisition");
test3("Astrometric Pinpointing");
test3("Astrometric Rangefinding");
echo "<tr><td colspan=2><center>Mining</center></td></tr>";
test3("Mining");
test3("Mining Upgrades");
test3("Astrogeology");
test3("Ice Harvesting");
test3("Gas Cloud Harvesting");
test3("Deep Core Mining");
test3("Mining Foreman");
test3("Mining Director");
echo "<tr><td colspan=2><center>Others</center></td></tr>";
test3("Cynosural Field Theory");
echo "</table>";
Exemple #3
0
<?php

function test1()
{
    var_dump(func_num_args());
}
function test2($a)
{
    var_dump(func_num_args());
}
function test3($a, $b)
{
    var_dump(func_num_args());
}
test1();
test2(1);
test2();
test3(1, 2);
call_user_func("test1");
call_user_func("test3", 1);
call_user_func("test3", 1, 2);
class test
{
    static function test1($a)
    {
        var_dump(func_num_args());
    }
}
test::test1(1);
var_dump(func_num_args());
echo "Done\n";
<?php

function test1(&$abc) : string
{
    return $abc;
}
function &test2(int $abc) : string
{
    return $abc;
}
function &test3(int &$abc) : string
{
    return $abc;
}
$a = 123;
var_dump(test1($a));
var_dump($a);
var_dump(test2($a));
var_dump($a);
var_dump(test3($a));
var_dump($a);
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// ****************************************************************************
// (C) ZZJ 5/xx/10
echo "<h4>Misc Skills</h4><hr>";
echo "<table style=\"font-size:88%\">\n";
echo "<tr><td colspan=2><center>Scanning</center></td></tr>";
test3("Astrometrics");
test3("Astrometric Acquisition");
test3("Astrometric Pinpointing");
test3("Astrometric Rangefinding");
echo "<tr><td colspan=2><center>Mining</center></td></tr>";
test3("Mining");
test3("Mining Upgrades");
test3("Astrogeology");
test3("Ice Harvesting");
test3("Gas Cloud Harvesting");
test3("Deep Core Mining");
test3("Mining Foreman");
test3("Mining Director");
echo "</table>";
}
function test3($param)
{
    echo $param . ' test3';
}
for ($i = 0; $i < count($argv); $i++) {
    if ($argv[$i] == '-s') {
        $param = $argv[$i + 1];
        run($param);
    } else {
        if ($argv[$i] == '-d') {
            $param = $argv[$i + 1];
            test1($param);
        } else {
            if ($argv[$i] == '-f') {
                $param = $argv[$i + 1];
                test2($param);
            } else {
                if ($argv[$i] == '--override') {
                    test3('override dan gelen  ');
                }
            }
        }
    }
}
if ($argc < 2) {
    $file = basename(__FILE__);
    print "STNC Autoincrement Generator" . CRLF;
    print "Usage: php -f {$file} -- -s komut \n [--override -d output_dir -f output_filename]" . CRLF;
    exit;
}
Exemple #7
0
    foreach ($a as $s) {
        $buf .= $s . 'h' . $s;
    }
    return $buf;
}
var_dump(test1(array(1)));
function test2()
{
    return f() . g() . f() . g();
}
var_dump(test2());
function test3()
{
    return f() . g() . f() . g() . f() . g() . f() . g() . f();
}
var_dump(test3());
function test4()
{
    $s = f();
    $s .= 'foo' . 'bar' . f() . 'foo' . 'baz' . f() . 'fuz' . 'boo' . f() . 'fiz' . 'faz';
    $s .= f();
    return $s;
}
var_dump(test4());
function test5()
{
    return g() . g() . g() . g();
}
var_dump(test5());
function test6()
{
        if (trim($_POST['page_selector_1']) == '') {
            $fecth_paged = 0;
        }
    }
    $wpdb->query($wpdb->prepare("update {$t_ap_config} set           \r\n\t\t\t   content_test_url = %s,\r\n\t\t\t   title_match_type = %d,\r\n\t\t\t   title_selector = %s,\r\n\t\t\t   content_match_type = %s,\r\n\t\t\t   content_selector = %s, \r\n\t\t\t   page_selector = %s,\r\n\t\t\t   fecth_paged = %d,\r\n\t\t\t   same_paged = %d  WHERE id = %d", $_POST['testUrl'], $_POST['title_match_type'], $title_selector, json_encode($content_match_type), json_encode($content_selector), json_encode($page_selector), $fecth_paged, $same_paged, $_POST['id']));
    $saction3 = $_POST['saction3'];
    if ($saction3 == 'test3') {
        test3($_POST['id'], $_POST['testUrl']);
    } else {
        echo '<div id="message" class="updated fade"><p>' . __('Updated!', 'wp-autopost') . '</p></div>';
    }
    $showBox3 = true;
}
// end if($saction=='save3'){
if ($saction == 'save3' && isset($_POST['use_auto_set'])) {
    test3($_POST['id'], $_POST['testUrl']);
}
if ($saction == 'save5') {
    $rewrite = array();
    switch ($_POST['use_rewriter']) {
        case '0':
            $wpdb->query($wpdb->prepare("update {$t_ap_config} set           \r\n\t\t\t   use_rewrite = %s WHERE id = %d", '0', $_POST['id']));
            echo '<div id="message" class="updated fade"><p>' . __('Updated!', 'wp-autopost') . '</p></div>';
            break;
        case '1':
            // Microsoft Translator
            $MicroTransOptions = get_option('wp-autopost-micro-trans-options');
            $transSetOk = false;
            foreach ($MicroTransOptions as $k => $v) {
                if ($v['clientID'] != null && $v['clientSecret'] != null) {
                    $transSetOk = true;
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// ****************************************************************************
echo "<h4>Racial Skills</h4><hr>\n";
echo "<table style=\"font-size:88%\">\n";
test3("Gallente Battleship");
test3("Amarr Battleship");
test3("Minmatar Battleship");
test3("Caldari Battleship");
tbBr();
test3("Gallente Battlecruiser");
test3("Amarr Battlecruiser");
test3("Minmatar Battlecruiser");
test3("Caldari Battlecruiser");
tbBr();
test3("Gallente Cruiser");
test3("Amarr Cruiser");
test3("Minmatar Cruiser");
test3("Caldari Cruiser");
tbBr();
test3("Gallente Destroyer");
test3("Amarr Destroyer");
test3("Minmatar Destroyer");
test3("Caldari Destroyer");
tbBr();
test3("Gallente Frigate");
test3("Amarr Frigate");
test3("Minmatar Frigate");
test3("Caldari Frigate");
echo "</table>";
<?php

function test1() : Generator
{
    (yield 1);
}
function test2() : Iterator
{
    (yield 2);
}
function test3() : Traversable
{
    (yield 3);
}
var_dump(test1(), test2(), test3());
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// ****************************************************************************
echo "<h4>Leadership</h4><hr>\n";
if (isLvl5("Leadership")) {
    echo "<table style=\"font-size:88%\">\n";
    test3("Leadership");
    test3("Warfare Link Specialist");
    test3("Armored Warfare Specialist");
    test3("Information Warfare Specialist");
    test3("Siege Warfare Specialist");
    test3("Skirmish Warfare Specialist");
    echo "</table>\n";
    echo "<br>\n";
    test2("Armored Warfare Mindlink");
    test2("Information Warfare Mindlink");
    test2("Siege Warfare Mindlink");
    test2("Skirmish Warfare Mindlink");
    test2("Mining Forman Mindlink");
    echo "<br>\n";
    test2(array("Eos", "Information Warfare Link - Recon Operation"), "a booster eos");
    test2(array("Damnation", "Armored Warfare Link - Damage Control"), "a booster damnation");
    test2(array("Claymore", "Skirmish Warfare Link - Evasive Maneuvers"), "a booster claymore");
    test2(array("Vulture", "Siege Warfare Link - Active Shielding"), "a booster vulture");
    test2(array("Damnation", "Armored Warfare Link - Damage Control", "Skirmish Warfare Link - Evasive Maneuvers"), "an atlas damnation");
    test2(array("Claymore", "Skirmish Warfare Link - Evasive Maneuvers", "Siege Warfare Link - Active Shielding"), "an atlas claymore");
    test2(array("Vulture", "Siege Warfare Link - Active Shielding", "Skirmish Warfare Link - Evasive Maneuvers"), "an atlas vulture");
Exemple #12
0
class bar
{
}
function test1(bar $bar)
{
    echo "ok\n";
}
function test2(\foo\bar $bar)
{
    echo "ok\n";
}
function test3(\foo\bar $bar)
{
    echo "ok\n";
}
function test4(\Exception $e)
{
    echo "ok\n";
}
function test5(\bar $bar)
{
    echo "bug\n";
}
$x = new bar();
$y = new \Exception();
test1($x);
test2($x);
test3($x);
test4($y);
test5($x);
$firstData = range(1, 10);
$secondData = range(11, 20);
function test1($firstData, $secondData)
{
    $data = [$firstData, $secondData];
    foreach ($data as $key => $value) {
        foreach ($value as $k => $v) {
            printf("%s: %s => %s\n", $key, $k, $v);
        }
    }
}
function test2($firstData, $secondData)
{
    $data = array_merge($firstData, $secondData);
    foreach ($data as $k => $v) {
        printf("%s => %s\n", $k, $v);
    }
}
function test3($firstData, $secondData)
{
    $firstIterator = new ArrayIterator($firstData);
    $secondIterator = new ArrayIterator($secondData);
    $append = new AppendIterator();
    $append->append($firstIterator);
    $append->append($secondIterator);
    foreach ($append as $key => $value) {
        printf("F: %s, S: %s, A: %s=>%s (%s)\n", $firstIterator->key(), $secondIterator->key(), $key, $value, $append->getIteratorIndex());
    }
}
test3($firstData, $secondData);
Exemple #14
0
//可变参数形式的函数
/*
func_num_args():得到传入函数参数的个数
func_get_arg($index):根据下标得到指定参数
func_get_args():得到所有传入进来的参数,得到是一个数组
*/
function test2()
{
    // 	echo func_num_args();
    // 	echo '<br/>';
    // 	echo func_get_arg(0),'<br/>';
    // 	echo func_get_arg(1),'<br/>';
    // 	echo func_get_arg(2),'<br/>';
    // 	echo func_get_arg(3),'<br/>';
    // 	echo func_get_arg(4),'<br/>';
    for ($i = 0, $count = func_num_args() - 1; $i <= $count; $i++) {
        echo func_get_arg($i);
        echo '<br/>';
    }
}
test2(1, 23, 4, 5, 6, 6, 54, 4, 'a', 'b', 'c', 'd', 'f', 'username');
echo '<hr color="red"/>';
function test3()
{
    // 	print_r(func_get_args());
    foreach (func_get_args() as $arg) {
        echo $arg, '<br/>';
    }
}
test3(123, 4, 5, 5, 54, 43, 1, 3, 3, 4, 5, 5, 'a', 'bv', 'c');
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// ****************************************************************************
echo "<h4>T2 Skills</h4><hr>\n";
echo "<table style=\"font-size:88%\">";
test3("Heavy Assault Ships");
test3("Heavy Interdictors");
test3("Recon Ships");
test3("Logistics");
test3("Command Ships");
tbBr();
test3("Black Ops");
test3("Marauders");
test3("Transport Ships");
tbBr();
test3("Covert Ops");
test3("Interceptors");
test3("Interdictors");
echo "</table>";
Exemple #16
0
function test2()
{
    test3();
}
test3("Minmatar Freighter");
test3("Caldari Freighter");
tbBr();
test3("Gallente Carrier");
test3("Amarr Carrier");
test3("Minmatar Carrier");
test3("Caldari Carrier");
tbBr();
test3("Gallente Dreadnought");
test3("Amarr Dreadnought");
test3("Minmatar Dreadnought");
test3("Caldari Dreadnought");
echo "</table>\n<br>";
echo "<a href=\"#\" style=\"font-size:80%;\" onclick=\"return toggle_visibility('capskills');\">Capital Support Skills</a><br>";
echo "<table style=\"font-size:88%; display:none;\" id=\"capskills\">";
test3("Capital Energy Turret");
test3("Capital Hybrid Turret");
test3("Capital Projectile Turret", "Capital Proj. Turret");
test3("Citadel Cruise Missiles", "Citadel Cruise");
test3("Citadel Torpedoes");
tbBr();
test3("Capital Energy Emission Systems", "Cap Energy Trans");
test3("Capital Shield Emission Systems", "Cap Shield Trans");
test3("Capital Remote Hull Repair Systems", "Cap Remote Hull");
test3("Capital Remote Armor Repair Systems", "Cap Remote Armour");
tbBr();
test3("Capital Repair Systems", "Cap Armour Rep");
test3("Capital Shield Operation", "Cap Shield Boost");
echo "</table><br>\n";
echo "<br>\n";
echo "jump skills: " . skillLvl("Jump Drive Operation") . "&nbsp;" . skillLvl("Jump Drive Calibration") . "&nbsp;" . skillLvl("Jump Fuel Conservation") . "<br>";
<?php

class A
{
    public static $var;
}
function test(&$arg)
{
    $arg = 2;
}
function test2(&$arg2)
{
    $arg2 = "abc";
}
function test3(array $arg)
{
}
test(A::$var);
test2(A::$var);
test3(A::$var);
test1();
// Echo global
echo $var . "<br />";
echo "<hr />";
// Define function scope global variable
function test2()
{
    global $var;
    $var = 2;
    echo $var;
    echo "<br />";
}
// Call function
test2();
echo $var . "<br />";
echo "<hr />";
// Define function scope global variable
function test3()
{
    static $var = 2;
    echo $var;
    echo "<br />";
    $var++;
}
// Call function
test3();
test3();
test3();
?>
	</body>
</html>
Exemple #20
0
        }
    }
    var_dump($buf);
}
test(array('a', 'b', 'c'), array('u', 'v'));
function test2($a, $b)
{
    $buf = 'hello';
    foreach ($a as $v) {
        $buf .= $v . ';';
        foreach ($b as $w) {
            $buf .= $w;
        }
        echo $buf;
    }
    var_dump($buf);
}
test2(array('a', 'b', 'c'), array('u', 'v'));
function test3($a, $b)
{
    $buf = 'hello';
    foreach ($a as $v) {
        $buf .= $v . ';';
        foreach ($b as $w) {
            echo $buf .= $w;
        }
    }
    var_dump($buf);
}
test3(array('a', 'b', 'c'), array('u', 'v'));