This is the out put for log failed it's a an array i want to like a text line like this
//John CentaurOne 26:Dec:2017:16:09:45 count => 1
//cena CentaurOne 26:Dec:2017:16:15:27 count => 1
//Bhumi CentaurOne 29:Dec:2017:09:39:45 29:Dec:2017:10:19:28 count => 2
how to convert to this please help me. i am new one for php
Array
(
[John] => Array
(
[CentaurOne] => Array
(
[0] => 26:Dec:2017:16:09:45
)
[count] => 1
)
[cena] => Array
(
[CentaurOne] => Array
(
[0] => 26:Dec:2017:16:15:27
)
[count] => 1
)
[Abc] => Array
(
[CentaurOne] => Array
(
[0] => 27:Dec:2017:09:25:25
[1] => 04/Jan/2018 15:54:35
)
[count] => 2
)
[Bhumi] => Array
(
[CentaurOne] => Array
(
[0] => 29:Dec:2017:09:39:45
[1] => 29:Dec:2017:10:19:28
)
[count] => 2
)
[Avccc] => Array
(
[CentaurOne] => Array
(
[0] => 29/Dec/2017 14:15:41
)
[count] => 1
)
)
What I have tried:
This is my php code for getting user name, date and systemname
$explode = file("failed.log",FILE_SKIP_EMPTY_LINES);
foreach($explode as $row)
{
# Explode the | character
$exp = explode('|',$row);
# Save the user to the an array
$new[$exp[0]][$exp[3]][]= $exp[1];
# Count how many times tried
if(!isset($new[$exp[0]]['count']))
$new[$exp[0]]['count'] = 1;
else
$new[$exp[0]]['count'] += 1;
}
$abc = print_r($new,true);
echo $abc;