3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $script='<script type="text/javascript"> cgiData={ pageIdx : 0, pageCount : 1, pageSize : 100, groupsList : ({"groups":[{"id":0,"name":"未分组","cnt":16},{"id":1,"name":"黑名单","cnt":0},{"id":2,"name":"星标组","cnt":0}]}).groups, friendsList : ({"contacts":[{"id":6,"nick_name":"yan","remark_name":"","group_id":0},{"id":8,"nick_name":"mm","remark_name":"","group_id":0},{"id":4,"nick_name":"gg","remark_name":"","group_id":0},{"id":2,"nick_name":"sa","remark_name":"","group_id":0}]}).contacts, currentGroupId : 0, type : 0, userRole : 1 * 1, verifyMsgCount : * 1 }; seajs.use("user/index"); </script>'; preg_match('%(?<=\"contacts\"\:)(.*)(?=}\)\.contacts)%', $script, $match); var_dump($match);
Output for 4.4.0 - 4.4.9, 5.0.5 - 7.1.0
array(2) { [0]=> string(226) "[{"id":6,"nick_name":"yan","remark_name":"","group_id":0},{"id":8,"nick_name":"mm","remark_name":"","group_id":0},{"id":4,"nick_name":"gg","remark_name":"","group_id":0},{"id":2,"nick_name":"sa","remark_name":"","group_id":0}]" [1]=> string(226) "[{"id":6,"nick_name":"yan","remark_name":"","group_id":0},{"id":8,"nick_name":"mm","remark_name":"","group_id":0},{"id":4,"nick_name":"gg","remark_name":"","group_id":0},{"id":2,"nick_name":"sa","remark_name":"","group_id":0}]" }
Output for 4.3.0 - 4.3.11, 5.0.0 - 5.0.4
array(0) { }