Exemple #1
0
}
function main3()
{
    // Get some locals.
    $a = rand(0, 10);
    $b = randstr();
    $c = randarr();
    $str = randstr();
    // Alias them in $aliases.
    $aliases = array();
    $aliases[] =& $a;
    $aliases[] =& $b;
    $aliases[] =& $c;
    // Wrap them up in an array and leak them into C().
    for ($i = 0; $i < 10; $i++) {
        echo "{$i} <\n";
        // Get some locals.
        $a = $i;
        $b = randstr();
        $c = randarr();
        // Read/write them while implicitly mutating them through the temporary
        // object's destructor.
        $unused = (tmpobj($aliases) === tmpobj($aliases)) === (($a === $b) === $c);
        echo " --------> \n";
        // ...and use them again.
        var_dump($a, $b, $c);
        echo ">\n";
    }
}
main3();
Exemple #2
0
    print_r($obj);
    unset($obj["x"]);
    print_r($obj);
    print "Test end\n";
}
main2();
class stringdoubler implements ArrayAccess
{
    public function offsetExists($i)
    {
        return is_string($i);
    }
    public function offsetGet($i)
    {
        return $i . $i;
    }
    public function offsetSet($i, $v)
    {
    }
    public function offsetUnset($i)
    {
    }
}
function main3($a, $b, $c)
{
    if (false) {
    }
    return $a[$b][$c];
}
var_dump(main3(array(new stringdoubler()), 0, 'hello'));