title: How To Use Preg_Match In php To Get Multiple Values From Json Data
body: <p>i have an json data and i am trying to getting values from that my json data looks like this</p>
  <pre><code>{&quot;code&quot;:0,&quot;error&quot;:false,&quot;message&quot;:&quot;Team Detail&quot;,&quot;data&quot;:{&quot;trump&quot;:null,&quot;team1&quot;:{&quot;id&quot;:827,&quot;name&quot;:&quot;Amerat Royals&quot;,&quot;sort_name&quot;:&quot;AME&quot;,&quot;image&quot;:&quot;https://exampe.com&quot;},&quot;vise_captain&quot;:{&quot;bowl_type&quot;:&quot; &quot;,&quot;image&quot;:&quot;https://exampe.com&quot;,&quot;country&quot;:&quot;null&quot;,&quot;player_pos&quot;:3,&quot;total_points&quot;:255.0,&quot;selected_as_vccaption&quot;:2.45,&quot;team_id&quot;:827,&quot;selected_as_trump&quot;:0.0,&quot;points&quot;:21.0,&quot;playing_squad_updated&quot;:&quot;Y&quot;,&quot;selected_as_caption&quot;:0.57,&quot;is_in_substitute_squad&quot;:&quot;N&quot;,&quot;player_id&quot;:113017,&quot;credits&quot;:8.5,&quot;dob&quot;:&quot;&quot;,&quot;bat_type&quot;:&quot; &quot;,&quot;name&quot;:&quot;K Sonavale&quot;,&quot;player_multiplier&quot;:1.5,&quot;position&quot;:&quot;batsman&quot;,&quot;is_in_playing_squad&quot;:&quot;Y&quot;,&quot;selected_by&quot;:93.47},&quot;team2&quot;:{&quot;id&quot;:826,&quot;name&quot;:&quot;Ghubrah Giants&quot;,&quot;sort_name&quot;:&quot;GHU&quot;,&quot;image&quot;:&quot;https://example.com&quot;},&quot;bowlers&quot;:[{&quot;bowl_type&quot;:&quot; &quot;,&quot;image&quot;:&quot;https://exampe.com&quot;,&quot;country&quot;:&quot;null&quot;,&quot;player_pos&quot;:10,&quot;total_points&quot;:166.0,&quot;selected_as_vccaption&quot;:0.0,&quot;team_id&quot;:827,&quot;selected_as_trump&quot;:0.0,&quot;points&quot;:0.0,&quot;playing_squad_updated&quot;:&quot;Y&quot;,&quot;selected_as_caption&quot;:0.97,&quot;is_in_substitute_squad&quot;:&quot;N&quot;,&quot;player_id&quot;:113028,&quot;credits&quot;:8.5,&quot;dob&quot;:&quot;&quot;,&quot;bat_type&quot;:&quot; &quot;,&quot;name&quot;:&quot;A Haq&quot;,&quot;player_multiplier&quot;:1.0,&quot;position&quot;:&quot;bowler&quot;,&quot;is_in_playing_squad&quot;:&quot;N&quot;,&quot;selected_by&quot;:18.17},{&quot;bowl_type&quot;:&quot; &quot;,&quot;image&quot;:&quot;https://exampe.com&quot;,&quot;country&quot;:&quot;null&quot;,&quot;player_pos&quot;:9,&quot;total_points&quot;:280.0,&quot;selected_as_vccaption&quot;:3.44,&quot;team_id&quot;:827,&quot;selected_as_trump&quot;:0.0,&quot;points&quot;:4.0,&quot;playing_squad_updated&quot;:&quot;Y&quot;,&quot;selected_as_caption&quot;:1.99,&quot;is_in_substitute_squad&quot;:&quot;N&quot;,&quot;player_id&quot;:113026,&quot;credits&quot;:9.0,&quot;dob&quot;:&quot;&quot;,&quot;bat_type&quot;:&quot; &quot;,&quot;name&quot;:&quot;Bilal-Khan&quot;,&quot;player_multiplier&quot;:1.0,&quot;position&quot;:&quot;bowler&quot;,&quot;is_in_playing_squad&quot;:&quot;Y&quot;,&quot;selected_by&quot;:97.35},{&quot;bowl_type&quot;:&quot; &quot;,&quot;image&quot;:&quot;https://exampe.com&quot;,&quot;country&quot;:&quot;Oman&quot;,&quot;player_pos&quot;:11,&quot;total_points&quot;:null,&quot;selected_as_vccaption&quot;:26.92,&quot;team_id&quot;:826,&quot;selected_as_trump&quot;:0.0,&quot;points&quot;:0.0,&quot;playing_squad_updated&quot;:&quot;Y&quot;,&quot;selected_as_caption&quot;:3.85,&quot;is_in_substitute_squad&quot;:&quot;N&quot;,&quot;player_id&quot;:113011,&quot;credits&quot;:8.0,&quot;dob&quot;:&quot;&quot;,&quot;bat_type&quot;:&quot; &quot;,&quot;name&quot;:&quot;I Khalid&quot;,&quot;player_multiplier&quot;:1.0,&quot;position&quot;:&quot;bowler&quot;,&quot;is_in_playing_squad&quot;:&quot;N&quot;,&quot;selected_by&quot;:4.59},{&quot;bowl_type&quot;:&quot; &quot;,&quot;image&quot;:&quot;https://exampe.com&quot;,&quot;country&quot;:&quot;Oman&quot;,&quot;player_pos&quot;:8,&quot;total_points&quot;:202.0,&quot;selected_as_vccaption&quot;:1.28,&quot;team_id&quot;:826,&quot;selected_as_trump&quot;:0.0,&quot;points&quot;:6.0,&quot;playing_squad_updated&quot;:&quot;Y&quot;,&quot;selected_as_caption&quot;:0.55,&quot;is_in_substitute_squad&quot;:&quot;N&quot;,&quot;player_id&quot;:112999,&quot;credits&quot;:9.0,&quot;dob&quot;:&quot;&quot;,&quot;bat_type&quot;:&quot; &quot;,&quot;name&quot;:&quot;A Khan&quot;,&quot;player_multiplier&quot;:1.0,&quot;position&quot;:&quot;bowler&quot;,&quot;is_in_playing_squad&quot;:&quot;Y&quot;,&quot;selected_by&quot;:96.12}],&quot;team_total_credits&quot;:95.5,&quot;captain&quot;:{&quot;bowl_type&quot;:&quot; &quot;,&quot;image&quot;:&quot;https://exampe.com&quot;,&quot;country&quot;:&quot;null&quot;,&quot;player_pos&quot;:2,&quot;total_points&quot;:375.0,&quot;selected_as_vccaption&quot;:36.15,&quot;team_id&quot;:827,&quot;selected_as_trump&quot;:0.0,&quot;points&quot;:4.0,&quot;playing_squad_updated&quot;:&quot;Y&quot;,&quot;selected_as_caption&quot;:5.58,&quot;is_in_substitute_squad&quot;:&quot;N&quot;,&quot;player_id&quot;:113021,&quot;credits&quot;:9.0,&quot;dob&quot;:&quot;&quot;,&quot;bat_type&quot;:&quot; &quot;,&quot;name&quot;:&quot;Rafiullah-M&quot;,&quot;player_multiplier&quot;:2.0,&quot;position&quot;:&quot;Batsman&quot;,&quot;is_in_playing_squad&quot;:&quot;Y&quot;,&quot;selected_by&quot;:98.06},&quot;team_total_points&quot;:94.5,&quot;team2_selected_player&quot;:6,&quot;name&quot;:1,&quot;allrounders&quot;:[{&quot;bowl_type&quot;:&quot; &quot;,&quot;image&quot;:&quot;https://exampe.com&quot;,&quot;country&quot;:&quot;null&quot;,&quot;player_pos&quot;:7,&quot;total_points&quot;:280.0,&quot;selected_as_vccaption&quot;:1.17,&quot;team_id&quot;:827,&quot;selected_as_trump&quot;:0.0,&quot;points&quot;:4.0,&quot;playing_squad_updated&quot;:&quot;Y&quot;,&quot;selected_as_caption&quot;:1.17,&quot;is_in_substitute_squad&quot;:&quot;N&quot;,&quot;player_id&quot;:113027,&quot;credits&quot;:8.5,&quot;dob&quot;:&quot;&quot;,&quot;bat_type&quot;:&quot; &quot;,&quot;name&quot;:&quot;H Tandel&quot;,&quot;player_multiplier&quot;:1.0,&quot;position&quot;:&quot;allrounder&quot;,&quot;is_in_playing_squad&quot;:&quot;Y&quot;,&quot;selected_by&quot;:90.65},{&quot;bowl_type&quot;:&quot; &quot;,&quot;image&quot;:&quot;https://exampe.com&quot;,&quot;country&quot;:&quot;Oman&quot;,&quot;player_pos&quot;:5,&quot;total_points&quot;:557.0,&quot;selected_as_vccaption&quot;:8.63,&quot;team_id&quot;:826,&quot;selected_as_trump&quot;:0.0,&quot;points&quot;:29.0,&quot;playing_squad_updated&quot;:&quot;Y&quot;,&quot;selected_as_caption&quot;:78.24,&quot;is_in_substitute_squad&quot;:&quot;N&quot;,&quot;player_id&quot;:113005,&quot;credits&quot;:9.0,&quot;dob&quot;:&quot;&quot;,&quot;bat_type&quot;:&quot; &quot;,&quot;name&quot;:&quot;I Latif&quot;,&quot;player_multiplier&quot;:1.0,&quot;position&quot;:&quot;allrounder&quot;,&quot;is_in_playing_squad&quot;:&quot;Y&quot;,&quot;selected_by&quot;:98.06},{&quot;bowl_type&quot;:&quot;Right Arm Medium Fast&quot;,&quot;image&quot;:&quot;https://exampe.com&quot;,&quot;country&quot;:&quot;Oman&quot;,&quot;player_pos&quot;:6,&quot;total_points&quot;:340.0,&quot;selected_as_vccaption&quot;:31.98,&quot;team_id&quot;:826,&quot;selected_as_trump&quot;:0.0,&quot;points&quot;:4.0,&quot;playing_squad_updated&quot;:&quot;Y&quot;,&quot;selected_as_caption&quot;:7.39,&quot;is_in_substitute_squad&quot;:&quot;N&quot;,&quot;player_id&quot;:62111,&quot;credits&quot;:8.5,&quot;dob&quot;:&quot;1977-01-08&quot;,&quot;bat_type&quot;:&quot;Right Hand Bat&quot;,&quot;name&quot;:&quot;G Iqbal&quot;,&quot;player_multiplier&quot;:1.0,&quot;position&quot;:&quot;allrounder&quot;,&quot;is_in_playing_squad&quot;:&quot;Y&quot;,&quot;selected_by&quot;:95.41}],&quot;id&quot;:2420219,&quot;wicketkeapers&quot;:[{&quot;bowl_type&quot;:&quot; &quot;,&quot;image&quot;:&quot;https://exampe.com&quot;,&quot;country&quot;:&quot;Oman&quot;,&quot;player_pos&quot;:1,&quot;total_points&quot;:157.0,&quot;selected_as_vccaption&quot;:1.67,&quot;team_id&quot;:826,&quot;selected_as_trump&quot;:0.0,&quot;points&quot;:4.0,&quot;playing_squad_updated&quot;:&quot;Y&quot;,&quot;selected_as_caption&quot;:3.33,&quot;is_in_substitute_squad&quot;:&quot;N&quot;,&quot;player_id&quot;:112993,&quot;credits&quot;:8.5,&quot;dob&quot;:&quot;&quot;,&quot;bat_type&quot;:&quot; &quot;,&quot;name&quot;:&quot;A Ullah-Qazi&quot;,&quot;player_multiplier&quot;:1.0,&quot;position&quot;:&quot;wicketkeeper&quot;,&quot;is_in_playing_squad&quot;:&quot;Y&quot;,&quot;selected_by&quot;:10.58}],&quot;batsmans&quot;:[{&quot;bowl_type&quot;:&quot; &quot;,&quot;image&quot;:&quot;https://exampe.com&quot;,&quot;country&quot;:&quot;null&quot;,&quot;player_pos&quot;:2,&quot;total_points&quot;:375.0,&quot;selected_as_vccaption&quot;:36.15,&quot;team_id&quot;:827,&quot;selected_as_trump&quot;:0.0,&quot;points&quot;:4.0,&quot;playing_squad_updated&quot;:&quot;Y&quot;,&quot;selected_as_caption&quot;:5.58,&quot;is_in_substitute_squad&quot;:&quot;N&quot;,&quot;player_id&quot;:113021,&quot;credits&quot;:9.0,&quot;dob&quot;:&quot;&quot;,&quot;bat_type&quot;:&quot; &quot;,&quot;name&quot;:&quot;Rafiullah-M&quot;,&quot;player_multiplier&quot;:2.0,&quot;position&quot;:&quot;Batsman&quot;,&quot;is_in_playing_squad&quot;:&quot;Y&quot;,&quot;selected_by&quot;:98.06},{&quot;bowl_type&quot;:&quot; &quot;,&quot;image&quot;:&quot;https://exampe.com&quot;,&quot;country&quot;:&quot;null&quot;,&quot;player_pos&quot;:3,&quot;total_points&quot;:255.0,&quot;selected_as_vccaption&quot;:2.45,&quot;team_id&quot;:827,&quot;selected_as_trump&quot;:0.0,&quot;points&quot;:21.0,&quot;playing_squad_updated&quot;:&quot;Y&quot;,&quot;selected_as_caption&quot;:0.57,&quot;is_in_substitute_squad&quot;:&quot;N&quot;,&quot;player_id&quot;:113017,&quot;credits&quot;:8.5,&quot;dob&quot;:&quot;&quot;,&quot;bat_type&quot;:&quot; &quot;,&quot;name&quot;:&quot;K Sonavale&quot;,&quot;player_multiplier&quot;:1.5,&quot;position&quot;:&quot;batsman&quot;,&quot;is_in_playing_squad&quot;:&quot;Y&quot;,&quot;selected_by&quot;:93.47},{&quot;bowl_type&quot;:&quot; &quot;,&quot;image&quot;:&quot;https://exampe.com&quot;,&quot;country&quot;:&quot;Oman&quot;,&quot;player_pos&quot;:4,&quot;total_points&quot;:167.0,&quot;selected_as_vccaption&quot;:1.6,&quot;team_id&quot;:826,&quot;selected_as_trump&quot;:0.0,&quot;points&quot;:4.0,&quot;playing_squad_updated&quot;:&quot;Y&quot;,&quot;selected_as_caption&quot;:2.56,&quot;is_in_substitute_squad&quot;:&quot;N&quot;,&quot;player_id&quot;:113003,&quot;credits&quot;:9.0,&quot;dob&quot;:&quot;&quot;,&quot;bat_type&quot;:&quot; &quot;,&quot;name&quot;:&quot;A Ali-I&quot;,&quot;player_multiplier&quot;:1.0,&quot;position&quot;:&quot;batsman&quot;,&quot;is_in_playing_squad&quot;:&quot;Y&quot;,&quot;selected_by&quot;:55.03}],&quot;team1_selected_player&quot;:5},&quot;server_date&quot;:1641056841}
  </code></pre>
  <p>Now For Every Player id I need that Data Like like Position ,total points and all that</p>
  <p>I want Final Data Like</p>
  <blockquote>
  <p>$playerdata='{&quot;bat_type&quot;:&quot;'.$bat_type.' &quot;,&quot;bowl_type&quot;:&quot;'.$$bowl_type.'
  &quot;,&quot;country&quot;:&quot;'.$country.'&quot;,&quot;credits&quot;:'.$credits.',&quot;dob&quot;:&quot;'.$dob.'&quot;,&quot;dream_team_player&quot;:null,&quot;full_name&quot;:&quot;'.$name.'&quot;,&quot;image&quot;:&quot;'.$image.'&quot;,&quot;is_in_playing_squad&quot;:&quot;'.$is_in_playing_squad.'&quot;,&quot;name&quot;:&quot;'.$name.'&quot;,&quot;playerType&quot;:'.$playerType.',&quot;player_id&quot;:&quot;'.$str.'&quot;,&quot;player_multiplier&quot;:'.$player_multiplier.',&quot;player_pos&quot;:'.$player_pos.',&quot;playing_squad_updated&quot;:&quot;'.$playing_squad_updated.'&quot;,&quot;points&quot;:'.$points.',&quot;position&quot;:&quot;'.$position.'&quot;,&quot;selected&quot;:true,&quot;selected_as_caption&quot;:&quot;'.$selected_as_caption.'&quot;,&quot;selected_as_trump&quot;:&quot;'.$selected_as_trump.'&quot;,&quot;selected_as_vccaption&quot;:&quot;'.$selected_as_vccaption.'&quot;,&quot;selected_by&quot;:'.$selected_by.',&quot;team_id&quot;:'.$team_id.',&quot;total_points&quot;:'.$total_points.'}';</p>
  </blockquote>
  <p>some values coming propley with preg_match but some not what i am doing wrong</p>