3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = ['foo'=>'1', 'bar'=>'2', 'baz'=>'3']; while(list($key, $value) = each($data)) { echo(sprintf('Current key is [%s] and value [%s]'.PHP_EOL, $key, $value)); if($value==='1') { end($data); $result = key($data); } } var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 2
Branch analysis from position: 25
Branch analysis from position: 2
Branch analysis from position: 17
filename:       /in/Pl9W7
function name:  (null)
number of ops:  29
compiled vars:  !0 = $data, !1 = $key, !2 = $value, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1      > JMP                                                      ->17
    6     2    >   INIT_FCALL                                               'sprintf'
          3        SEND_VAL                                                 'Current+key+is+%5B%25s%5D+and+value+%5B%25s%5D%0A'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $5      
          7        ECHO                                                     $5
    7     8        IS_IDENTICAL                                             !2, '1'
          9      > JMPZ                                                     ~6, ->17
    9    10    >   INIT_FCALL                                               'end'
         11        SEND_REF                                                 !0
         12        DO_ICALL                                                 
   10    13        INIT_FCALL                                               'key'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $8      
         16        ASSIGN                                                   !3, $8
    4    17    >   INIT_FCALL_BY_NAME                                       'each'
         18        SEND_VAR_EX                                              !0
         19        DO_FCALL                                      0  $10     
         20        FETCH_LIST_R                                     $11     $10, 0
         21        ASSIGN                                                   !1, $11
         22        FETCH_LIST_R                                     $13     $10, 1
         23        ASSIGN                                                   !2, $13
         24      > JMPNZ                                                    $10, ->2
   13    25    >   INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !3
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.03 ms | 1396 KiB | 21 Q