3v4l.org

run code in 500+ PHP versions simultaneously
<?php function containsOnlyNull(array $array): bool { foreach ($array as $value) { if ($value !== null) { return false; } } return true; } echo 'a: ' . var_export(containsOnlyNull([null,null,null,null,null]), true); // 5 iterations for true outcome echo "\n"; echo 'b: ' . var_export(containsOnlyNull([null,null,1,null,null]), true); // 3 iterations for false outcome
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2uYgo
function name:  (null)
number of ops:  20
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                                   'var_export'
          1        INIT_FCALL                                                   'containsonlynull'
          2        SEND_VAL                                                     <array>
          3        DO_FCALL                                          0  $0      
          4        SEND_VAR                                                     $0
          5        SEND_VAL                                                     <true>
          6        DO_ICALL                                             $1      
          7        CONCAT                                               ~2      'a%3A+', $1
          8        ECHO                                                         ~2
   14     9        ECHO                                                         '%0A'
   15    10        INIT_FCALL                                                   'var_export'
         11        INIT_FCALL                                                   'containsonlynull'
         12        SEND_VAL                                                     <array>
         13        DO_FCALL                                          0  $3      
         14        SEND_VAR                                                     $3
         15        SEND_VAL                                                     <true>
         16        DO_ICALL                                             $4      
         17        CONCAT                                               ~5      'b%3A+', $4
         18        ECHO                                                         ~5
         19      > RETURN                                                       1

Function containsonlynull:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 8
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/2uYgo
function name:  containsOnlyNull
number of ops:  12
compiled vars:  !0 = $array, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    5     1      > FE_RESET_R                                           $2      !0, ->8
          2    > > FE_FETCH_R                                                   $2, !1, ->8
    6     3    >   TYPE_CHECK                                      1020          !1
          4      > JMPZ                                                         ~3, ->7
    7     5    >   FE_FREE                                                      $2
          6      > RETURN                                                       <false>
    5     7    > > JMP                                                          ->2
          8    >   FE_FREE                                                      $2
   10     9      > RETURN                                                       <true>
   11    10*       VERIFY_RETURN_TYPE                                           
         11*     > RETURN                                                       null

End of function containsonlynull

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
193.12 ms | 2028 KiB | 16 Q