Thursday, 30 August 2018

How to print an associative array in foreach

I have an associative array in php, how can i print it with php foreach loop

Array( [0] => Array ( [fb_user_id] => 100000058716604 [accept_status] => 1 ) [1] => Array ( [fb_user_id] => 100004069844270 [accept_status] => 1 ) )

Tried this but no success, i want to print the fb_user_id
 foreach($resulttotal[fb_user_id] as $value)
 {
      echo $value;
 }

Please help me, Thanks

You doing incorrectly, It will be like:
foreach($resulttotal as $value)
{
   echo $value['fb_user_id'];
}

0 comments:

Post a Comment