How to integrate two for/foreach loops in following scenario?

前端 未结 5 451
忘了有多久
忘了有多久 2021-01-27 06:39

I\'m having two arrays as follows:

$user_ids = Array
(
    [0] => 159a8a6f1c00c5c4d5d0daaab2aa4227
    [1] => a39777761f7816031aec676c80c3a8ad
    [2] =>         


        
5条回答
  •  南方客
    南方客 (楼主)
    2021-01-27 06:57

    Maybe like this?

    $user_ids = explode(',', $request['items']);
      $user_statuses = explode(',', $request['user_status']);
      foreach ($user_statuses as $key => $user_status) { 
        if(user_status=='disable') {
          $objAdminUsers->UpdateUserStatus($user_ids[$key], $user_status); 
        }
      }
    

提交回复
热议问题