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-- Test array_splice() function : usage variations - non array replacement values --..

Decoded Output download

--TEST--
Test array_splice() function : usage variations - non array replacement values
--FILE--
<?php
/*
 * Function is implemented in ext/standard/array.c
*/

function test_splice ($replacement)
{
    $input_array=array(0,1);
    var_dump (array_splice ($input_array,2,0,$replacement));
    var_dump ($input_array);
}

test_splice (2);

test_splice (2.1);

test_splice (true);
//file type resource
$file_handle = fopen(__FILE__, "r");

test_splice ($file_handle);
echo "Done
";
?>
--EXPECTF--
array(0) {
}
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  int(2)
}
array(0) {
}
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  float(2.1)
}
array(0) {
}
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  bool(true)
}
array(0) {
}
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  resource(%d) of type (stream)
}
Done

Did this file decode correctly?

Original Code

--TEST--
Test array_splice() function : usage variations - non array replacement values
--FILE--
<?php
/*
 * Function is implemented in ext/standard/array.c
*/

function test_splice ($replacement)
{
    $input_array=array(0,1);
    var_dump (array_splice ($input_array,2,0,$replacement));
    var_dump ($input_array);
}

test_splice (2);

test_splice (2.1);

test_splice (true);
//file type resource
$file_handle = fopen(__FILE__, "r");

test_splice ($file_handle);
echo "Done\n";
?>
--EXPECTF--
array(0) {
}
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  int(2)
}
array(0) {
}
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  float(2.1)
}
array(0) {
}
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  bool(true)
}
array(0) {
}
array(3) {
  [0]=>
  int(0)
  [1]=>
  int(1)
  [2]=>
  resource(%d) of type (stream)
}
Done

Function Calls

test_splice 1
array_splice 1

Variables

$input_array [{'key': 0, 'value': 0}, {'key': 1, 'value': 1}]
$replacement 2

Stats

MD5 f9935441eebb2be03ac885ad23377078
Eval Count 0
Decode Time 109 ms