Пример #1
0
function __()
{
    $GLOBALS['a'] = "bug\n";
    array_splice($GLOBALS, 0, count($GLOBALS));
    /* All global variables including $GLOBALS are removed */
    @__var_dump($GLOBALS['a']);
}
Пример #2
0
function f5()
{
    $c = extract(array("111" => 1), EXTR_PREFIX_ALL, "prefix");
    echo "Extracted:";
    __var_dump($c);
    __var_dump(get_defined_vars());
}
Пример #3
0
function dump($elems)
{
    foreach ($elems as $elem) {
        __var_dump($elem->nodeName);
        dump($elem->childNodes);
    }
}
Пример #4
0
function test($v)
{
    //echo var_export($v, true) . "\n";
    __var_dump($v);
    echo "{$v}\n";
    //print_r($v);
    echo "\n------\n";
}
Пример #5
0
 function test($x = Foo::HUN)
 {
     static $arr2 = array(TEN => 'ten');
     static $arr = array(Foo::HUN => 'ten');
     __var_dump($arr);
     __var_dump($arr2);
     __var_dump($x);
 }
Пример #6
0
function g7()
{
    $a = 1;
    $b = 2;
    f($a = $a =& $b);
    u($a = $a =& $b);
    __var_dump($a, $b);
}
Пример #7
0
function does_not_work()
{
    global $data;
    // Remove this line to make array_multisort() work
    $data = array('first', 'fifth', 'second', 'forth', 'third');
    $sort = array(1, 5, 2, 4, 3);
    array_multisort($sort, $data);
    __var_dump($data);
}
Пример #8
0
 function __construct()
 {
     $this->name = 'init';
     $this->other = 'other';
     __var_dump($this);
     parent::__construct();
     echo __CLASS__ . "::" . __FUNCTION__ . "\n";
     $this->name = 'derived';
     __var_dump($this);
 }
Пример #9
0
function extract_test($array, $type, $prefix)
{
    ${"a d"} = "hello";
    ${0} = "hello";
    ${""} = "hello";
    $ad = null;
    ${"000g"} = "hello";
    $prefix_ad = "hello";
    __var_dump(extract($array, $type, $prefix));
    unset($array, $type, $prefix);
    $vars = get_defined_vars();
    ksort($vars, SORT_STRING);
    __var_dump($vars);
}
Пример #10
0
function t3()
{
    $a = array('foo' => 'aaa');
    // refcount($a) = 1
    // refcount($a['foo']) = 1
    $b =& $a;
    // refcount($a) = 2
    // is_ref($a) = true
    // refcount($a['foo']) = 1
    unset($b);
    // refcount($a) = 1
    // is_ref($a) = true
    // refcount($a['foo']) = 1
    __var_dump($a);
    extract($a, EXTR_REFS);
    $foo = 'noo';
    __var_dump($a);
}
Пример #11
0
[expect php]
[file]
<?php 
require 'Phalanger.inc';
/* This works */
$f = array('7' => 0);
__var_dump($f);
__var_dump(array_key_exists(7, $f));
__var_dump(array_key_exists('7', $f));
print "----------\n";
/* This doesn't */
$f = array_flip(array('7'));
__var_dump($f);
__var_dump(array_key_exists(7, $f));
__var_dump(array_key_exists('7', $f));
Пример #12
0
[expect php]
[file]
<?php 
require 'Phalanger.inc';
__var_dump(strripos("test test string", "test"));
__var_dump(strripos("test string sTring", "string"));
__var_dump(strripos("test strip string strand", "str"));
__var_dump(strripos("I am what I am and that's all what I am", "am", -3));
__var_dump(strripos("test string", "g"));
__var_dump(strripos("te" . chr(0) . "st", chr(0)));
__var_dump(strripos("tEst", "test"));
__var_dump(strripos("teSt", "test"));
__var_dump(@strripos("foo", "f", 1));
__var_dump(@strripos("", ""));
__var_dump(@strripos("a", ""));
__var_dump(@strripos("", "a"));
__var_dump(@strripos("\\\\a", "\\a"));
Пример #13
0
__var_dump(str_word_count($str, 123));
__var_dump(str_word_count($str, -1));
__var_dump(str_word_count($str, 99999999999999999));
// invalid input: __var_dump(str_word_count($str, array()));
// invalid input: __var_dump(str_word_count($str, $b));
__var_dump($str);
$str2 = "F0o B4r 1s bar foo";
__var_dump(str_word_count($str2, NULL, "04"));
__var_dump(str_word_count($str2, NULL, "01"));
__var_dump(str_word_count($str2, NULL, "014"));
// invalid input: __var_dump(str_word_count($str2, NULL, array()));
// invalid input: __var_dump(str_word_count($str2, NULL, new stdClass));
__var_dump(str_word_count($str2, NULL, ""));
__var_dump(str_word_count($str2, 1, "04"));
__var_dump(str_word_count($str2, 1, "01"));
__var_dump(str_word_count($str2, 1, "014"));
// invalid input: __var_dump(str_word_count($str2, 1, array()));
// invalid input: __var_dump(str_word_count($str2, 1, new stdClass));
__var_dump(str_word_count($str2, 1, ""));
__var_dump(str_word_count($str2, 2, "04"));
__var_dump(str_word_count($str2, 2, "01"));
__var_dump(str_word_count($str2, 2, "014"));
// invalid input: __var_dump(str_word_count($str2, 2, array()));
// invalid input: __var_dump(str_word_count($str2, 2, new stdClass));
__var_dump(str_word_count($str2, 2, ""));
__var_dump(str_word_count("foo'0 bar-0var", 2, "0"));
__var_dump(str_word_count("'foo'", 2));
__var_dump(str_word_count("'foo'", 2, "'"));
__var_dump(str_word_count("-foo-", 2));
__var_dump(str_word_count("-foo-", 2, "-"));
Пример #14
0
[expect php]
[file]
<?php 
include 'Phalanger.inc';
__var_dump(number_format(0.0001, 1));
__var_dump(number_format(0.0001, 0));
Пример #15
0
[expect php]
[file]
<?php 
include 'Phalanger.inc';
$arrays = array(array(), array(0), array(1), array(-1), array(0, 2), array(1, 2, 3), array(1 => 0), array(2 => 1), array(3 => -1), array(1 => 0, 2 => 2), array(1 => 1, 2 => 2, 3 => 3), array(0 => 0, 3 => 2), array(1 => 1, 5 => 2, 8 => 3), array(1, 2), array(0, 1, 2), array(1, 2, 3), array(0, 1, 2, 3), array(1, 2, 3, 4), array(0, 1, 2, 3, 4), array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10), array("a" => 1), array("b" => 1, "c" => 2), array("p" => 1, "q" => 2, "r" => 3, "s" => 4, "u" => 5, "v" => 6), array("a" => "A"), array("p" => "A", "q" => "B", "r" => "C", "s" => "D", "u" => "E", "v" => "F"));
foreach ($arrays as $item) {
    echo "===========================================\n";
    __var_dump($item);
    echo "-------------------------------------------\n";
    for ($i = 0; $i < sizeof($item) + 1; $i++) {
        echo "[{$i}]\n";
        __var_dump(@array_chunk($item, $i));
        __var_dump(@array_chunk($item, $i, TRUE));
        __var_dump(@array_chunk($item, $i, FALSE));
        echo "\n";
    }
    echo "\n";
}
echo "end\n";
Пример #16
0
[expect php]
[file]
<?php 
require 'Phalanger.inc';
$foo = 'bar';
__var_dump(strval($foo));
define('FOO', 'BAR');
__var_dump(strval(FOO));
__var_dump(strval('foobar'));
__var_dump(strval(1));
__var_dump(strval(1.1));
__var_dump(strval(true));
__var_dump(strval(false));
Пример #17
0
[expect php]
[file]
<?php 
include 'Phalanger.inc';
$f = -INF;
__var_dump($f);
__var_dump(serialize($f));
__var_dump(unserialize(serialize($f)));
$f = INF;
__var_dump($f);
__var_dump(serialize($f));
__var_dump(unserialize(serialize($f)));
$f = NAN;
__var_dump($f);
__var_dump(serialize($f));
__var_dump(unserialize(serialize($f)));
Пример #18
0
<?php 
require 'Phalanger.inc';
$var = "aaaaaaaa";
__var_dump(substr_replace($var, 'b', 0));
__var_dump(substr_replace($var, 'b', 0, strlen($var)));
__var_dump(substr_replace($var, 'b', 0, 0));
__var_dump(substr_replace($var, 'b', 10, -1));
__var_dump(substr_replace($var, 'b', -7, -1));
__var_dump(substr_replace($var, 'b', 10, -1));
echo "\n";
__var_dump(substr_count($var, 'a', 0));
__var_dump(substr_count($var, 'a', 0, strlen($var)));
__var_dump(@substr_count($var, null, 0, 0));
__var_dump(@substr_count($var, '', 0, 0));
__var_dump(@substr_count($var, 'a', -1, -1));
__var_dump(@substr_count($var, 'a', 3, 0));
__var_dump(@substr_count($var, 'a', 10, -1));
__var_dump(@substr_count($var, 'a', 6, 6));
echo "\n";
__var_dump(substr_replace(array("a" => $var, 10 => $var, "b" => null, "", " "), 'b', -10, 5));
echo "\n";
__var_dump(substr_compare("abcde", "bc", 1, 2));
// 0
__var_dump(substr_compare("abcde", "bcg", 1, 2));
// 0
__var_dump(substr_compare("abcde", "BC", 1, 2, true));
// 0
__var_dump(substr_compare("abcde", "bc", 1, 3));
// 1
__var_dump(substr_compare("abcde", "cd", 1, 2));
// -1
Пример #19
0
[expect php]
[file]
<?php 
include 'Phalanger.inc';
function f(&$par)
{
    $par = "Set in f() function";
}
f($a);
var_dump($a);
class A
{
    public $a;
}
class B
{
    function f(&$par)
    {
        $par = "Set in B->f() method";
    }
}
$o = new A();
$o->a = new B();
$r =& $o->a->f($a);
__var_dump($o, $r, $a);
Пример #20
0
[expect php]
[file]
<?php 
require 'Phalanger.inc';
__var_dump(strstr("test string", "test"));
__var_dump(strstr("test string", "string"));
__var_dump(strstr("test string", "strin"));
__var_dump(strstr("test string", "t s"));
__var_dump(strstr("test string", "g"));
__var_dump(md5(strstr("te" . chr(0) . "st", chr(0))));
__var_dump(strstr("tEst", "test"));
__var_dump(strstr("teSt", "test"));
__var_dump(@strstr("", ""));
__var_dump(@strstr("a", ""));
__var_dump(@strstr("", "a"));
__var_dump(md5(@strstr("\\\\a\\", "\\a")));
Пример #21
0
[expect php]
[file]
<?php 
include 'Phalanger.inc';
class T
{
    static $a = array(false => "false", true => "true");
}
__var_dump(T::$a);
define("X", 0);
define("Y", 1);
class T2
{
    static $a = array(X => "false", Y => "true");
}
__var_dump(T2::$a);
Пример #22
0
[expect php]
[file]
<?php 
include 'Phalanger.inc';
include 'Autoload.inc';
//error_reporting(0);
__var_dump(interface_exists('autoload_interface', false));
__var_dump(class_exists('autoload_implements', false));
$o = unserialize('O:19:"Autoload_Implements":0:{}');
__var_dump($o);
__var_dump($o instanceof autoload_interface);
unset($o);
__var_dump(interface_exists('autoload_interface', false));
__var_dump(class_exists('autoload_implements', false));
Пример #23
0
[expect php]
[file]
<?php 
require 'Phalanger.inc';
/* Do not change this test it is a README.TESTING example. */
$trans = array("hello" => "hi", "hi" => "hello", "a" => "A", "world" => "planet");
__var_dump(strtr("# hi all, I said hello world! #", $trans));
Пример #24
0
 function a($arg)
 {
     __var_dump(array_key_exists($arg, $this->test));
     return $this->test[$arg];
 }
Пример #25
0
[expect php]
[file]
<?php 
require 'Phalanger.inc';
__var_dump(dirname("C:\\"), dirname("C:/"), dirname("somedir/somefile"), dirname("/"), dirname("/dir"), dirname("/dir/"), dirname("/etc/passwd"), dirname("\\etc\\passwd"), dirname("c:\\temp\\file.tmp"));
?>
 
Пример #26
0
__var_dump($obj[1]);
__var_dump($obj[2]);
__var_dump($obj['4th']);
@__var_dump($obj['5th']);
@__var_dump($obj[6]);
echo "===offsetSet===\n";
echo "WRITE 1\n";
$obj[1] = 'Changed 1';
__var_dump($obj[1]);
echo "WRITE 2\n";
$obj['4th'] = 'Changed 4th';
__var_dump($obj['4th']);
echo "WRITE 3\n";
$obj['5th'] = 'Added 5th';
__var_dump($obj['5th']);
echo "WRITE 4\n";
$obj[6] = 'Added 6';
__var_dump($obj[6]);
__var_dump($obj[0]);
__var_dump($obj[2]);
$x = $obj[6] = 'changed 6';
__var_dump($obj[6]);
__var_dump($x);
echo "===unset===\n";
__var_dump($obj->a);
unset($obj[2]);
unset($obj['4th']);
unset($obj[7]);
unset($obj['8th']);
__var_dump($obj->a);
Пример #27
0
[expect php]
[file]
<?php 
include 'Phalanger.inc';
class test
{
    public $a, $b;
    function test()
    {
        $this->a = 7;
        $this->b = 2;
    }
    function __sleep()
    {
        $this->b = 0;
    }
}
$t['one'] = 'ABC';
$t['two'] = new test();
__var_dump($t);
$s = @serialize($t);
echo $s . "\n";
__var_dump(unserialize($s));
Пример #28
0
[expect php]
[file]
<?php 
include 'Phalanger.inc';
$foo = "ABC = DEF";
$fmt = "%s = %s %n";
$res_a = array();
/* $res_a[2] is supposed to be a integer value that
 * represents the number of characters consumed so far
 */
sscanf($foo, $fmt, $res_a[0], $res_a[1], $res_a[2]);
$res_b = sscanf($foo, $fmt);
__var_dump($res_a);
__var_dump($res_b);
Пример #29
0
[expect php]
[file]
<?php 
require 'Phalanger.inc';
class z extends domDocument
{
    /** variable can have name */
    public $p_array;
    public $p_variable;
    function __construct()
    {
        $this->p_array[] = 'bonus';
        $this->p_array[] = 'vir';
        $this->p_array[] = 'semper';
        $this->p_array[] = 'tiro';
        $this->p_variable = 'Cessante causa cessat effectus';
    }
}
$z = new z();
__var_dump($z->p_array);
__var_dump($z->p_variable);
Пример #30
0
[expect php]
[file]
<?php 
require 'Phalanger.inc';
$a = "22222222aaaa bbb1111 cccc";
$b = "1234";
__var_dump($a);
__var_dump($b);
__var_dump(strcspn($a, $b));
__var_dump(strcspn($a, $b, 9));
__var_dump(strcspn($a, $b, 9, 6));