7
I have the following array:
Array
(
[0] => MemTotal: 4060964 kB
[1] => MemFree: 3630320 kB
[2] => MemAvailable: 3789472 kB
[3] => Buffers: 93040 kB
[4] => SwapCached: 0
[6] => Active: 306312 kB
)
I need to rewrite this array so it looks like this:
Array
(
[MemTotal] => 4060964 kB
[MemFree] => 3630320 kB
[MemAvailable] => 3789472 kB
[Buffers] => 93040 kB
[SwapCached] => 0
)
The rules would be:
- The index is everything that comes before two-points (:)
- The content is preceded by two-points and a sequence of one or more space characters
How to do this parse?
Was the only one who picked up on the example given +1.
– Jorge B.