<?php
$arrayMax = function ($max, $value) use (&$arrayMax) {
if (is_array($value)) return array_reduce($value, $arrayMax, $max);
elseif (is_int($value)) return $max === null ? $value : max($max, $value);
else return $max;
}
var_dump(array_reduce([5, 7, 2, ['25', [20]]], $arrayMax));
- Output for 5.4.0 - 5.4.15
- Parse error: syntax error, unexpected 'var_dump' (T_STRING) in mDkJK on line 9
Process exited with code 255. - Output for 5.3.25
- Parse error: syntax error, unexpected T_STRING in /in/fYAoO on line 9
Process exited with code 255. - Output for 5.3.0 - 5.3.24
- Parse error: syntax error, unexpected T_STRING in mDkJK on line 9
Process exited with code 255.
preferences:
177.8 ms | 1386 KiB | 49 Q