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_walk() function : usage variations - 'input' argument containing refer..

Decoded Output download

*** Testing array_walk() : array with references ***

Did this file decode correctly?

Original Code

--TEST--
Test array_walk() function : usage variations - 'input' argument containing reference variables
--FILE--
<?php
/*
 * Testing array_walk() with an array having reference variables
*/

echo "*** Testing array_walk() : array with references ***\n";

$value1 = 10;
$value2 = -20;
$value3 = &$value1;
$value4 = 50;

// 'input' array containing references to above variables
$input = array(&$value1, &$value2, -35, &$value3, 0, &$value4);

function callback($value, $key)
{
   // dump the arguments to check that they are passed
   // with proper type
   var_dump($key);  // key
   var_dump($value); // value
   echo "\n"; // new line to separate the output between each element
}

var_dump( array_walk($input, "callback"));

echo "Done"
?>
--EXPECT--
*** Testing array_walk() : array with references ***
int(0)
int(10)

int(1)
int(-20)

int(2)
int(-35)

int(3)
int(10)

int(4)
int(0)

int(5)
int(50)

bool(true)
Done

Function Calls

array_walk 1

Variables

$input [{'key': 0, 'value': 10}, {'key': 1, 'value': -20}, {'key': 2, 'value': -35}, {'key': 3, 'value': 10}, {'key': 4, 'value': 0}, {'key': 5, 'value': 50}]
$value1 10
$value2 -20
$value3 10
$value4 50

Stats

MD5 0dc20ad9bbec4a1df03d3a436115561c
Eval Count 0
Decode Time 83 ms