3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result2 = '{ "wg0": { "privateKey": "[hidden]", "publicKey": "XXXXXXXXXXXXXXXXXXX", "listenPort": 0, "peers": { "B3GtLuabWguXoG2Tz8KVukPXx3twn7A+X/SVT8=": { "endpoint": "0.0.0.0:5377", "latestHandshake": "Oct 28, 2020 1:58:32 UTC", "transferRx": "2.432 GB", "transferTx": "1.098 GB", "allowedIps": [ "10.85.85.2/32" ] }, "2Uqo3X2ubogU92LS4mWsZtF04ah3qJ4gt1g0=": { "endpoint": "0.0.0.0:5412", "latestHandshake": "Oct 28, 2020 1:58:52 UTC", "transferRx": "32.239 MB", "transferTx": "220.852 MB", "allowedIps": [ "10.85.85.3/32" ] } } } }'; $obj2 = json_decode($result2, true); $IPtoSearch = "10.85.85.2/32"; foreach ($obj2['wg0']['peers'] as $peer) { if (in_array($IPtoSearch, $peer['allowedIps'])) { $latestHandshake = $peer['latestHandshake']; break; } } echo "Last handshake for $IPtoSearch was at $latestHandshake\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 21
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 21
Branch analysis from position: 21
filename:       /in/GssGs
function name:  (null)
number of ops:  29
compiled vars:  !0 = $result2, !1 = $obj2, !2 = $IPtoSearch, !3 = $peer, !4 = $latestHandshake
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%0A+%22wg0%22%3A+%7B%0A+++%22privateKey%22%3A+%22%5Bhidden%5D%22%2C%0A+++%22publicKey%22%3A+%22XXXXXXXXXXXXXXXXXXX%22%2C%0A+++%22listenPort%22%3A+0%2C%0A+++%22peers%22%3A+%7B%0A+++++%22B3GtLuabWguXoG2Tz8KVukPXx3twn7A%2BX%2FSVT8%3D%22%3A+%7B%0A+++++++%22endpoint%22%3A+%220.0.0.0%3A5377%22%2C%0A+++++++%22latestHandshake%22%3A+%22Oct+28%2C+2020+1%3A58%3A32+UTC%22%2C%0A+++++++%22transferRx%22%3A+%222.432+GB%22%2C%0A+++++++%22transferTx%22%3A+%221.098+GB%22%2C%0A+++++++%22allowedIps%22%3A+%5B%0A+++++++++%2210.85.85.2%2F32%22%0A+++++++%5D%0A+++++%7D%2C%0A+++++%222Uqo3X2ubogU92LS4mWsZtF04ah3qJ4gt1g0%3D%22%3A+%7B%0A+++++++%22endpoint%22%3A+%220.0.0.0%3A5412%22%2C%0A+++++++%22latestHandshake%22%3A+%22Oct+28%2C+2020+1%3A58%3A52+UTC%22%2C%0A+++++++%22transferRx%22%3A+%2232.239+MB%22%2C%0A+++++++%22transferTx%22%3A+%22220.852+MB%22%2C%0A+++++++%22allowedIps%22%3A+%5B%0A+++++++++%2210.85.85.3%2F32%22%0A+++++++%5D%0A+++++%7D%0A+++%7D%0A+%7D%0A%7D'
   31     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !1, $6
   32     6        ASSIGN                                                   !2, '10.85.85.2%2F32'
   34     7        FETCH_DIM_R                                      ~9      !1, 'wg0'
          8        FETCH_DIM_R                                      ~10     ~9, 'peers'
          9      > FE_RESET_R                                       $11     ~10, ->21
         10    > > FE_FETCH_R                                               $11, !3, ->21
   35    11    >   INIT_FCALL                                               'in_array'
         12        SEND_VAR                                                 !2
         13        FETCH_DIM_R                                      ~12     !3, 'allowedIps'
         14        SEND_VAL                                                 ~12
         15        DO_ICALL                                         $13     
         16      > JMPZ                                                     $13, ->20
   36    17    >   FETCH_DIM_R                                      ~14     !3, 'latestHandshake'
         18        ASSIGN                                                   !4, ~14
   37    19      > JMP                                                      ->21
   34    20    > > JMP                                                      ->10
         21    >   FE_FREE                                                  $11
   41    22        ROPE_INIT                                     5  ~17     'Last+handshake+for+'
         23        ROPE_ADD                                      1  ~17     ~17, !2
         24        ROPE_ADD                                      2  ~17     ~17, '+was+at+'
         25        ROPE_ADD                                      3  ~17     ~17, !4
         26        ROPE_END                                      4  ~16     ~17, '%0A'
         27        ECHO                                                     ~16
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.41 ms | 1432 KiB | 15 Q