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-- array_pad() tests --FILE-- <?php var_dump(array_pad(array(), 1, 0)); var_dump(a..

Decoded Output download

--TEST--
array_pad() tests
--FILE--
<?php

var_dump(array_pad(array(), 1, 0));

var_dump(array_pad(array(), 0, 0));
var_dump(array_pad(array(), -1, 0));
var_dump(array_pad(array("", -1, 2.0), 5, 0));
var_dump(array_pad(array("", -1, 2.0), 5, array()));
var_dump(array_pad(array("", -1, 2.0), 2, array()));
var_dump(array_pad(array("", -1, 2.0), -3, array()));
var_dump(array_pad(array("", -1, 2.0), -4, array()));

try {
    var_dump(array_pad(array("", -1, 2.0), 2000000, 0));
} catch (\ValueError $e) {
    echo $e->getMessage() . "
";
}

?>
--EXPECT--
array(1) {
  [0]=>
  int(0)
}
array(0) {
}
array(1) {
  [0]=>
  int(0)
}
array(5) {
  [0]=>
  string(0) ""
  [1]=>
  int(-1)
  [2]=>
  float(2)
  [3]=>
  int(0)
  [4]=>
  int(0)
}
array(5) {
  [0]=>
  string(0) ""
  [1]=>
  int(-1)
  [2]=>
  float(2)
  [3]=>
  array(0) {
  }
  [4]=>
  array(0) {
  }
}
array(3) {
  [0]=>
  string(0) ""
  [1]=>
  int(-1)
  [2]=>
  float(2)
}
array(3) {
  [0]=>
  string(0) ""
  [1]=>
  int(-1)
  [2]=>
  float(2)
}
array(4) {
  [0]=>
  array(0) {
  }
  [1]=>
  string(0) ""
  [2]=>
  int(-1)
  [3]=>
  float(2)
}
array_pad(): Argument #2 ($length) must be less than or equal to 1048576

Did this file decode correctly?

Original Code

--TEST--
array_pad() tests
--FILE--
<?php

var_dump(array_pad(array(), 1, 0));

var_dump(array_pad(array(), 0, 0));
var_dump(array_pad(array(), -1, 0));
var_dump(array_pad(array("", -1, 2.0), 5, 0));
var_dump(array_pad(array("", -1, 2.0), 5, array()));
var_dump(array_pad(array("", -1, 2.0), 2, array()));
var_dump(array_pad(array("", -1, 2.0), -3, array()));
var_dump(array_pad(array("", -1, 2.0), -4, array()));

try {
    var_dump(array_pad(array("", -1, 2.0), 2000000, 0));
} catch (\ValueError $e) {
    echo $e->getMessage() . "\n";
}

?>
--EXPECT--
array(1) {
  [0]=>
  int(0)
}
array(0) {
}
array(1) {
  [0]=>
  int(0)
}
array(5) {
  [0]=>
  string(0) ""
  [1]=>
  int(-1)
  [2]=>
  float(2)
  [3]=>
  int(0)
  [4]=>
  int(0)
}
array(5) {
  [0]=>
  string(0) ""
  [1]=>
  int(-1)
  [2]=>
  float(2)
  [3]=>
  array(0) {
  }
  [4]=>
  array(0) {
  }
}
array(3) {
  [0]=>
  string(0) ""
  [1]=>
  int(-1)
  [2]=>
  float(2)
}
array(3) {
  [0]=>
  string(0) ""
  [1]=>
  int(-1)
  [2]=>
  float(2)
}
array(4) {
  [0]=>
  array(0) {
  }
  [1]=>
  string(0) ""
  [2]=>
  int(-1)
  [3]=>
  float(2)
}
array_pad(): Argument #2 ($length) must be less than or equal to 1048576

Function Calls

array_pad 1

Variables

None

Stats

MD5 a694d92529ae4bb8f25c3c280df8d4b8
Eval Count 0
Decode Time 78 ms