I'm taking the results of a shell_exec() call in linux and explode()'ing the contents on spaces to $mem_array
Here is the pre-exploded text:
total: used: free: shared: buffers: cached: Mem: 128237568 124055552 4182016 0 31543296 42881024 Swap: 268427264 0 268427264 MemTotal: 125232 kB MemFree: 4084 kB MemShared: 0 kB Buffers: 30804 kB Cached: 41876 kB SwapCached: 0 kB Active: 32096 kB Inactive: 72636 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 125232 kB LowFree: 4084 kB SwapTotal: 262136 kB SwapFree: 262136 kB
What I want to do is search on a string and then just add 1 to the array to get the value like this:
psuedo-code:
[pre]$string = 'MemTotal:'
$total_memory = $mem_array[$stringlocationinarray + 1][/pre]
I thought there was a function for finding values in an array that would return the values array ref (in_array looked promising but only returns true if value is in array) but so far I haven't found it so any help would be apprechiated.
TIA