<?php
var_dump(floatval('Undefined'));
echo PHP_EOL;
$unresponsives2 = $unresponsives = [
[
"Customer",
"172.52.46.75",
"2022-04-01 16:20:45",
"1817",
"nxlog",
"2328.02 Hours"
],
[
"Customer",
"172.25.89.45",
"2022-04-01 16:20:45",
"1817",
"nxlog",
"Undefined"
],
[
"Customer",
"172.19.10.94",
"2022-04-01 16:20:45",
"1817",
"nxlog",
"2324.02 Hours"
],
[
"Customer",
"172.19.10.94",
"2022-04-01 16:20:45",
"1817",
"nxlog",
"2322.02 Hours"
],
[
"Customer",
"172.19.10.94",
"2022-04-01 16:20:45",
"1817",
"nxlog",
"Undefined"
],
];
$hours = array_column($unresponsives, 5);
if ($undefined = array_keys($hours, 'Undefined')) {
$hours = array_replace($hours, array_fill_keys($undefined, PHP_INT_MAX));
}
array_multisort($hours, SORT_DESC, SORT_NUMERIC, $unresponsives);
var_export($unresponsives);
echo PHP_EOL . PHP_EOL;
$hours = array_column($unresponsives2, 5);
if ($undefined = array_keys($hours, 'Undefined')) {
$hours = array_replace($hours, array_fill_keys($undefined, PHP_INT_MIN));
}
array_multisort($hours, SORT_ASC, SORT_NUMERIC, $unresponsives2);
var_export($unresponsives2);
- Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
- float(0)
array (
0 =>
array (
0 => 'Customer',
1 => '172.19.10.94',
2 => '2022-04-01 16:20:45',
3 => '1817',
4 => 'nxlog',
5 => 'Undefined',
),
1 =>
array (
0 => 'Customer',
1 => '172.25.89.45',
2 => '2022-04-01 16:20:45',
3 => '1817',
4 => 'nxlog',
5 => 'Undefined',
),
2 =>
array (
0 => 'Customer',
1 => '172.52.46.75',
2 => '2022-04-01 16:20:45',
3 => '1817',
4 => 'nxlog',
5 => '2328.02 Hours',
),
3 =>
array (
0 => 'Customer',
1 => '172.19.10.94',
2 => '2022-04-01 16:20:45',
3 => '1817',
4 => 'nxlog',
5 => '2324.02 Hours',
),
4 =>
array (
0 => 'Customer',
1 => '172.19.10.94',
2 => '2022-04-01 16:20:45',
3 => '1817',
4 => 'nxlog',
5 => '2322.02 Hours',
),
)
array (
0 =>
array (
0 => 'Customer',
1 => '172.19.10.94',
2 => '2022-04-01 16:20:45',
3 => '1817',
4 => 'nxlog',
5 => 'Undefined',
),
1 =>
array (
0 => 'Customer',
1 => '172.25.89.45',
2 => '2022-04-01 16:20:45',
3 => '1817',
4 => 'nxlog',
5 => 'Undefined',
),
2 =>
array (
0 => 'Customer',
1 => '172.19.10.94',
2 => '2022-04-01 16:20:45',
3 => '1817',
4 => 'nxlog',
5 => '2322.02 Hours',
),
3 =>
array (
0 => 'Customer',
1 => '172.19.10.94',
2 => '2022-04-01 16:20:45',
3 => '1817',
4 => 'nxlog',
5 => '2324.02 Hours',
),
4 =>
array (
0 => 'Customer',
1 => '172.52.46.75',
2 => '2022-04-01 16:20:45',
3 => '1817',
4 => 'nxlog',
5 => '2328.02 Hours',
),
)
preferences:
85.63 ms | 406 KiB | 123 Q