3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array_list = 'a:5:{i:0;a:3:{s:2:"id";s:3:"191";s:4:"name";s:3:"Ali";s:5:"range";s:5:"today";}i:1;a:3:{s:2:"id";s:3:"190";s:4:"name";s:4:"John";s:5:"range";s:5:"today";}i:2;a:3:{s:2:"id";s:3:"189";s:4:"name";s:5:"peter";s:5:"range";s:12:"in last week";}i:3;a:3:{s:2:"id";s:3:"180";s:4:"name";s:3:"Ali";s:5:"range";s:12:"in last week";}i:4;a:3:{s:2:"id";s:3:"170";s:4:"name";s:4:"Jack";s:5:"range";s:12:"in last week";}}'; $array_list = unserialize($array_list); $new_list = array(); foreach( $array_list as $list ) $new_list[$list['range']][] = $list; ?> <div id="notification_box"> <?php foreach( $new_list as $item_name => $items ): ?> <div class= "cases"> <div class="title"><?php echo $item_name ?></div> <?php if( $items && is_array( $items ) ) { ?> <table> <?php foreach( $items as $item ): ?> <tr> <td><?php echo $item['id'] ?></td> <td><?php echo $item['name'] ?></td> </tr> <?php endforeach; ?> </table> <?php } ?> </div> <?php endforeach; ?> </div>

preferences:
58.77 ms | 404 KiB | 5 Q