3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); $values = ['true', false]; $needle = true; $inArray = array_reduce($values, function ($inArray, $value) use ($needle) { return $inArray || $value === $needle; }); var_dump(in_array(true, $values)); var_dump($inArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aq3a2
function name:  (null)
number of ops:  20
compiled vars:  !0 = $values, !1 = $needle, !2 = $inArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !1, <true>
    8     2        INIT_FCALL                                               'array_reduce'
          3        SEND_VAR                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Faq3a2%3A8%240'
          5        BIND_LEXICAL                                             ~5, !1
   10     6        SEND_VAL                                                 ~5
          7        DO_ICALL                                         $6      
    8     8        ASSIGN                                                   !2, $6
   12     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'in_array'
         11        SEND_VAL                                                 <true>
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $8      
         14        SEND_VAR                                                 $8
         15        DO_ICALL                                                 
   13    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Faq3a2%3A8%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/aq3a2
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $inArray, !1 = $value, !2 = $needle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
    9     3      > JMPNZ_EX                                         ~3      !0, ->6
          4    >   IS_IDENTICAL                                     ~4      !1, !2
          5        BOOL                                             ~3      ~4
          6    > > RETURN                                                   ~3
   10     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Faq3a2%3A8%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.84 ms | 1396 KiB | 19 Q