3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = 'a'; $b = '3'; $x = []; $contains_key = /** * @param array<string, string> $arr * @param string $key */ function(array $arr, string $key): bool { foreach($arr as $k => $_v) { if ($k === $key) { return true; } } return false; }; var_dump($contains_key($x, $a)); $x[$a] = 'yes'; var_dump($contains_key($x, $a)); var_dump($contains_key($x, $b)); $x[$b] = 'yes'; var_dump($contains_key($x, $b));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fekWt
function name:  (null)
number of ops:  38
compiled vars:  !0 = $a, !1 = $b, !2 = $x, !3 = $contains_key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'a'
    4     1        ASSIGN                                                   !1, '3'
    6     2        ASSIGN                                                   !2, <array>
   13     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfekWt%3A13%240'
    8     4        ASSIGN                                                   !3, ~7
   24     5        INIT_FCALL                                               'var_dump'
          6        INIT_DYNAMIC_CALL                                        !3
          7        SEND_VAR_EX                                              !2
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0  $9      
         10        SEND_VAR                                                 $9
         11        DO_ICALL                                                 
   25    12        ASSIGN_DIM                                               !2, !0
         13        OP_DATA                                                  'yes'
   26    14        INIT_FCALL                                               'var_dump'
         15        INIT_DYNAMIC_CALL                                        !3
         16        SEND_VAR_EX                                              !2
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0  $12     
         19        SEND_VAR                                                 $12
         20        DO_ICALL                                                 
   29    21        INIT_FCALL                                               'var_dump'
         22        INIT_DYNAMIC_CALL                                        !3
         23        SEND_VAR_EX                                              !2
         24        SEND_VAR_EX                                              !1
         25        DO_FCALL                                      0  $14     
         26        SEND_VAR                                                 $14
         27        DO_ICALL                                                 
   30    28        ASSIGN_DIM                                               !2, !1
         29        OP_DATA                                                  'yes'
   31    30        INIT_FCALL                                               'var_dump'
         31        INIT_DYNAMIC_CALL                                        !3
         32        SEND_VAR_EX                                              !2
         33        SEND_VAR_EX                                              !1
         34        DO_FCALL                                      0  $17     
         35        SEND_VAR                                                 $17
         36        DO_ICALL                                                 
         37      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FfekWt%3A13%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/fekWt
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $arr, !1 = $key, !2 = $_v, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2      > FE_RESET_R                                       $4      !0, ->10
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->10
          4    >   ASSIGN                                                   !3, ~5
   15     5        IS_IDENTICAL                                             !3, !1
          6      > JMPZ                                                     ~7, ->9
   16     7    >   FE_FREE                                                  $4
          8      > RETURN                                                   <true>
   14     9    > > JMP                                                      ->3
         10    >   FE_FREE                                                  $4
   20    11      > RETURN                                                   <false>
   21    12*       VERIFY_RETURN_TYPE                                       
         13*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FfekWt%3A13%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.75 ms | 1404 KiB | 15 Q