3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getMembers($offset, $count){ $offset = intval($offset); $url = 'https://api.vk.com/method/groups.getMembers?group_id=roem&offset='.$offset.'&count='.$count; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); curl_close($ch); return json_decode($data, true); } $offset = 0; $count = 1000; $data = getMembers($offset, $count); $users = $data["response"]["users"]; # echo var_dump($users); $numUsers = intval($data["response"]["count"]); echo var_dump($numUsers); $offset = 1000; while (count($users) <= $numUsers){ $count = $numUsers - count($users) > 1000 ? 1000 : $numUsers - count($users); echo $numUsers."-".count($users)."=".$count."\n"; $data = getMembers($offset, $count); $temp = $data["response"]["users"]; if ($count < 1000) echo var_dump($temp); $users = array_merge((array)$users, (array)$temp); $offset += 1000; } echo var_dump($users);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 20
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 51
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 20
Branch analysis from position: 62
Branch analysis from position: 20
Branch analysis from position: 51
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 51
Branch analysis from position: 47
Branch analysis from position: 51
filename:       /in/OpoHi
function name:  (null)
number of ops:  67
compiled vars:  !0 = $offset, !1 = $count, !2 = $data, !3 = $users, !4 = $numUsers, !5 = $temp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, 0
   12     1        ASSIGN                                                   !1, 1000
   13     2        INIT_FCALL                                               'getmembers'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0  $8      
          6        ASSIGN                                                   !2, $8
   14     7        FETCH_DIM_R                                      ~10     !2, 'response'
          8        FETCH_DIM_R                                      ~11     ~10, 'users'
          9        ASSIGN                                                   !3, ~11
   16    10        FETCH_DIM_R                                      ~13     !2, 'response'
         11        FETCH_DIM_R                                      ~14     ~13, 'count'
         12        CAST                                          4  ~15     ~14
         13        ASSIGN                                                   !4, ~15
   17    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !4
         16        DO_ICALL                                         $17     
         17        ECHO                                                     $17
   18    18        ASSIGN                                                   !0, 1000
   19    19      > JMP                                                      ->59
   20    20    >   COUNT                                            ~19     !3
         21        SUB                                              ~20     !4, ~19
         22        IS_SMALLER                                               1000, ~20
         23      > JMPZ                                                     ~21, ->26
         24    >   QM_ASSIGN                                        ~22     1000
         25      > JMP                                                      ->29
         26    >   COUNT                                            ~23     !3
         27        SUB                                              ~24     !4, ~23
         28        QM_ASSIGN                                        ~22     ~24
         29    >   ASSIGN                                                   !1, ~22
   21    30        CONCAT                                           ~26     !4, '-'
         31        COUNT                                            ~27     !3
         32        CONCAT                                           ~28     ~26, ~27
         33        CONCAT                                           ~29     ~28, '%3D'
         34        CONCAT                                           ~30     ~29, !1
         35        CONCAT                                           ~31     ~30, '%0A'
         36        ECHO                                                     ~31
   22    37        INIT_FCALL                                               'getmembers'
         38        SEND_VAR                                                 !0
         39        SEND_VAR                                                 !1
         40        DO_FCALL                                      0  $32     
         41        ASSIGN                                                   !2, $32
   23    42        FETCH_DIM_R                                      ~34     !2, 'response'
         43        FETCH_DIM_R                                      ~35     ~34, 'users'
         44        ASSIGN                                                   !5, ~35
   24    45        IS_SMALLER                                               !1, 1000
         46      > JMPZ                                                     ~37, ->51
         47    >   INIT_FCALL                                               'var_dump'
         48        SEND_VAR                                                 !5
         49        DO_ICALL                                         $38     
         50        ECHO                                                     $38
   25    51    >   INIT_FCALL                                               'array_merge'
         52        CAST                                          7  ~39     !3
         53        SEND_VAL                                                 ~39
         54        CAST                                          7  ~40     !5
         55        SEND_VAL                                                 ~40
         56        DO_ICALL                                         $41     
         57        ASSIGN                                                   !3, $41
   26    58        ASSIGN_OP                                     1          !0, 1000
   19    59    >   COUNT                                            ~44     !3
         60        IS_SMALLER_OR_EQUAL                                      ~44, !4
         61      > JMPNZ                                                    ~45, ->20
   30    62    >   INIT_FCALL                                               'var_dump'
         63        SEND_VAR                                                 !3
         64        DO_ICALL                                         $46     
         65        ECHO                                                     $46
         66      > RETURN                                                   1

Function getmembers:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OpoHi
function name:  getMembers
number of ops:  31
compiled vars:  !0 = $offset, !1 = $count, !2 = $url, !3 = $ch, !4 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        CAST                                          4  ~5      !0
          3        ASSIGN                                                   !0, ~5
    4     4        CONCAT                                           ~7      'https%3A%2F%2Fapi.vk.com%2Fmethod%2Fgroups.getMembers%3Fgroup_id%3Droem%26offset%3D', !0
          5        CONCAT                                           ~8      ~7, '%26count%3D'
          6        CONCAT                                           ~9      ~8, !1
          7        ASSIGN                                                   !2, ~9
          8        INIT_FCALL_BY_NAME                                       'curl_init'
          9        SEND_VAR_EX                                              !2
         10        DO_FCALL                                      0  $11     
         11        ASSIGN                                                   !3, $11
    5    12        INIT_FCALL_BY_NAME                                       'curl_setopt'
         13        SEND_VAR_EX                                              !3
         14        FETCH_CONSTANT                                   ~13     'CURLOPT_RETURNTRANSFER'
         15        SEND_VAL_EX                                              ~13
         16        SEND_VAL_EX                                              1
         17        DO_FCALL                                      0          
    6    18        INIT_FCALL_BY_NAME                                       'curl_exec'
         19        SEND_VAR_EX                                              !3
         20        DO_FCALL                                      0  $15     
         21        ASSIGN                                                   !4, $15
    7    22        INIT_FCALL_BY_NAME                                       'curl_close'
         23        SEND_VAR_EX                                              !3
         24        DO_FCALL                                      0          
    8    25        INIT_FCALL                                               'json_decode'
         26        SEND_VAR                                                 !4
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $18     
         29      > RETURN                                                   $18
    9    30*     > RETURN                                                   null

End of function getmembers

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.7 ms | 1407 KiB | 21 Q