Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $commentsArray = [['comment'=>'blabla1', 'time'=>time()-3600],
- ['comment'=>'blabla2', 'time'=>time()-7200],
- ['comment'=>'blabla3', 'time'=>time()-3100]];
- $i = 0;
- foreach ($commentsArray as $arr) {
- $comments[$i] = $arr['comment'];
- $times[$i] = $arr['time'];
- $i++;
- }
- array_multisort($times, $comments);
- echo "<pre>", print_r($comments, true), "</pre>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement