3v4l.org

run code in 300+ PHP versions simultaneously
<?php $payloads = [ 'a' => [null, null, null, null, null], 'b' => [null, null, 1, null, null] ]; foreach ($payloads as $key => $payload) { printf( "%s: %s, %s, %s\n", $key, var_export( array_reduce( $payload, fn($acc, $v) => $acc && $v === null, true ), true ), var_export( !array_filter( $payload, fn($v) => $v !== null ), true ), var_export( $payload === array_filter($payload, 'is_null'), true ) ); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 41
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 41
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
filename:       /in/8TPZq
function name:  (null)
number of ops:  43
compiled vars:  !0 = $payloads, !1 = $payload, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1      > FE_RESET_R                                       $4      !0, ->41
          2    > > FE_FETCH_R                                       ~5      $4, !1, ->41
          3    >   ASSIGN                                                   !2, ~5
    9     4        INIT_FCALL                                               'printf'
   10     5        SEND_VAL                                                 '%25s%3A+%25s%2C+%25s%2C+%25s%0A'
   11     6        SEND_VAR                                                 !2
   12     7        INIT_FCALL                                               'var_export'
   13     8        INIT_FCALL                                               'array_reduce'
   14     9        SEND_VAR                                                 !1
   15    10        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
         11        SEND_VAL                                                 ~7
   16    12        SEND_VAL                                                 <true>
   13    13        DO_ICALL                                         $8      
   16    14        SEND_VAR                                                 $8
   18    15        SEND_VAL                                                 <true>
   12    16        DO_ICALL                                         $9      
   18    17        SEND_VAR                                                 $9
   20    18        INIT_FCALL                                               'var_export'
   21    19        INIT_FCALL                                               'array_filter'
   22    20        SEND_VAR                                                 !1
   23    21        DECLARE_LAMBDA_FUNCTION                          ~10     [1]
   24    22        SEND_VAL                                                 ~10
   21    23        DO_ICALL                                         $11     
   24    24        BOOL_NOT                                         ~12     $11
         25        SEND_VAL                                                 ~12
   25    26        SEND_VAL                                                 <true>
   20    27        DO_ICALL                                         $13     
   25    28        SEND_VAR                                                 $13
   27    29        INIT_FCALL                                               'var_export'
   28    30        INIT_FCALL                                               'array_filter'
         31        SEND_VAR                                                 !1
         32        SEND_VAL                                                 'is_null'
         33        DO_ICALL                                         $14     
         34        IS_IDENTICAL                                     ~15     !1, $14
         35        SEND_VAL                                                 ~15
   29    36        SEND_VAL                                                 <true>
   27    37        DO_ICALL                                         $16     
   29    38        SEND_VAR                                                 $16
    9    39        DO_ICALL                                                 
    8    40      > JMP                                                      ->2
         41    >   FE_FREE                                                  $4
   32    42      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/8TPZq
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $acc, !1 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > JMPZ_EX                                          ~2      !0, ->5
          3    >   TYPE_CHECK                                    2  ~3      !1
          4        BOOL                                             ~2      ~3
          5    > > RETURN                                                   ~2
          6*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8TPZq
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        TYPE_CHECK                                  1020  ~1      !0
          2      > RETURN                                                   ~1
   24     3*     > RETURN                                                   null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.33 ms | 1018 KiB | 17 Q