I have this array
$test = $_POST['test'];
print_r($test);
Array
(
[0] => Array
(
[id] => 26629
[timestamp] => 1332273712
)
[1] => Array
(
[id] => 26628
[timestamp] => 1332243526
)
[2] => Array
(
[id] => 26627
[timestamp] => 1332237777
)
I want to get timestamp value and using a funciton to change it to something like 5 sec ago,4 hours ago and so on. The function is the easy part i’m just goin to use time() – timestamp..
Then when i get the new value have to make a new array with them that is going to content something like that
Array
(
[0] => Array
(
[id] => 26629
[content] => 5 sec ago
)
[1] => Array
(
[id] => 26628
[content] => 4 hours ago
)
[2] => Array
(
[id] => 26627
[content] => 1 hour ago
)
Probably i have to use foreach but i dont know how 🙁
You can use array_walk_recursive().
Your could could look like this:
Code I am testing with: