Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- SPL: ArrayObject --FILE-- <?php $ar = array(0=>0, 1=>1); $ar = new ArrayObject($..

Decoded Output download

--TEST--
SPL: ArrayObject
--FILE--
<?php

$ar = array(0=>0, 1=>1);
$ar = new ArrayObject($ar);

var_dump($ar);

$ar[2] = 2;
var_dump($ar[2]);
var_dump($ar["3"] = 3);

var_dump(array_merge((array)$ar, array(4=>4, 5=>5)));

var_dump($ar["a"] = "a");

var_dump($ar);
var_dump($ar[0]);
var_dump($ar[6]);
var_dump($ar["b"]);

unset($ar[1]);
unset($ar["3"]);
unset($ar["a"]);
unset($ar[7]);
unset($ar["c"]);
var_dump($ar);

$ar[] = '3';
$ar[] = 4;
var_dump($ar);

?>
--EXPECTF--
object(ArrayObject)#%d (1) {
  ["storage":"ArrayObject":private]=>
  array(2) {
    [0]=>
    int(0)
    [1]=>
    int(1)
  }
}
int(2)
int(3)
array(6) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  int(2)
  [3]=>
  int(3)
  [4]=>
  int(4)
  [5]=>
  int(5)
}
string(1) "a"
object(ArrayObject)#%d (1) {
  ["storage":"ArrayObject":private]=>
  array(5) {
    [0]=>
    int(0)
    [1]=>
    int(1)
    [2]=>
    int(2)
    [3]=>
    int(3)
    ["a"]=>
    string(1) "a"
  }
}
int(0)

Warning: Undefined array key 6 in %s on line %d
NULL

Warning: Undefined array key "b" in %s on line %d
NULL
object(ArrayObject)#%d (1) {
  ["storage":"ArrayObject":private]=>
  array(2) {
    [0]=>
    int(0)
    [2]=>
    int(2)
  }
}
object(ArrayObject)#%d (1) {
  ["storage":"ArrayObject":private]=>
  array(4) {
    [0]=>
    int(0)
    [2]=>
    int(2)
    [4]=>
    string(1) "3"
    [5]=>
    int(4)
  }
}

Did this file decode correctly?

Original Code

--TEST--
SPL: ArrayObject
--FILE--
<?php

$ar = array(0=>0, 1=>1);
$ar = new ArrayObject($ar);

var_dump($ar);

$ar[2] = 2;
var_dump($ar[2]);
var_dump($ar["3"] = 3);

var_dump(array_merge((array)$ar, array(4=>4, 5=>5)));

var_dump($ar["a"] = "a");

var_dump($ar);
var_dump($ar[0]);
var_dump($ar[6]);
var_dump($ar["b"]);

unset($ar[1]);
unset($ar["3"]);
unset($ar["a"]);
unset($ar[7]);
unset($ar["c"]);
var_dump($ar);

$ar[] = '3';
$ar[] = 4;
var_dump($ar);

?>
--EXPECTF--
object(ArrayObject)#%d (1) {
  ["storage":"ArrayObject":private]=>
  array(2) {
    [0]=>
    int(0)
    [1]=>
    int(1)
  }
}
int(2)
int(3)
array(6) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  int(2)
  [3]=>
  int(3)
  [4]=>
  int(4)
  [5]=>
  int(5)
}
string(1) "a"
object(ArrayObject)#%d (1) {
  ["storage":"ArrayObject":private]=>
  array(5) {
    [0]=>
    int(0)
    [1]=>
    int(1)
    [2]=>
    int(2)
    [3]=>
    int(3)
    ["a"]=>
    string(1) "a"
  }
}
int(0)

Warning: Undefined array key 6 in %s on line %d
NULL

Warning: Undefined array key "b" in %s on line %d
NULL
object(ArrayObject)#%d (1) {
  ["storage":"ArrayObject":private]=>
  array(2) {
    [0]=>
    int(0)
    [2]=>
    int(2)
  }
}
object(ArrayObject)#%d (1) {
  ["storage":"ArrayObject":private]=>
  array(4) {
    [0]=>
    int(0)
    [2]=>
    int(2)
    [4]=>
    string(1) "3"
    [5]=>
    int(4)
  }
}

Function Calls

None

Variables

$ar [{'key': 0, 'value': 0}, {'key': 1, 'value': 1}]

Stats

MD5 0967a4527e2341a6c6dea7fcd04766aa
Eval Count 0
Decode Time 99 ms