Okay I have been trying all day long with Regex and some other methods with no luck, here's what i'm trying to do i will try to make it as simple as I can, this an API and I am getting JSON response from my site like this:
{"user_id":1,"username":"xxx","email":"xxx@xxx.com","gender":"male","title":"","language_id":1,"timezone":"Africa\/Nairobi","visible":1,"activity_visible":1,"user_group_id":3,"secondary_group_ids":"2,4,6,8,11,12,13,16,19,20","message_count":235,"conversations_unread":0,"register_date":1424485355,"last_activity":1436186781,"trophy_points":43,"alerts_unread":2,"avatar_date":1435657653,"avatar_width":180,"avatar_height":224,"gravatar":"","user_state":"valid","is_moderator":0,"is_admin":1,"is_banned":0,"like_count":127,"warning_points":0,"is_staff":1,"advapps":"a:1:{i:0;a:2:{s:5:\"posid\";i:1;s:5:\"count\";i:5;}}","brms_statistic_perferences":"a:1:{i:1;s:1:\"0\";}","bratr_ratings":38,"tc_cui_icon":"","tc_cui_color":"#000000","breta_user_level":5,"breta_curent_level":34,"breta_next_level":45,"credits":"13402154377.480000","brc_points":"999999.000000","br_profile_image":"","br_cropy":"0.00",""}}
What i want to extract is user_group_id
and secondary_group_ids
then parse the numbers and add them to array then compare them with the given number, i want to check if the member is in that group number (secondary or primary does not matter).
How can i do that with the best and easiest way?