3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 'egg' => true, 'cheese' => false, 'hair' => 765, 'goblins' => null, 'ogres' => 'no ogres allowed in this array' ); echo "// Loose checking\n\n"; // return values are in comments // First three make sense, last four do not echo (in_array(null, $array) ? 'true' : 'false')."\n"; // true echo (in_array(false, $array) ? 'true' : 'false')."\n"; // true echo (in_array(765, $array) ? 'true' : 'false')."\n"; // true echo (in_array(763, $array) ? 'true' : 'false')."\n"; // true echo (in_array('egg', $array) ? 'true' : 'false')."\n"; // true echo (in_array('hhh', $array) ? 'true' : 'false')."\n"; // true echo (in_array(array(), $array) ? 'true' : 'false')."\n"; // true echo "\n\n// Strict checking\n\n"; echo (in_array(null, $array, true) ? 'true' : 'false')."\n"; // true echo (in_array(false, $array, true) ? 'true' : 'false')."\n"; // true echo (in_array(765, $array, true) ? 'true' : 'false')."\n"; // true echo (in_array(763, $array, true) ? 'true' : 'false')."\n"; // false echo (in_array('egg', $array, true) ? 'true' : 'false')."\n"; // false echo (in_array('hhh', $array, true) ? 'true' : 'false')."\n"; // false echo (in_array(array(), $array, true) ? 'true' : 'false')."\n"; // false
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 59
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
2 jumps found. (Code = 43) Position 1 = 67, Position 2 = 69
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
2 jumps found. (Code = 43) Position 1 = 79, Position 2 = 81
Branch analysis from position: 79
1 jumps found. (Code = 42) Position 1 = 82
Branch analysis from position: 82
2 jumps found. (Code = 43) Position 1 = 90, Position 2 = 92
Branch analysis from position: 90
1 jumps found. (Code = 42) Position 1 = 93
Branch analysis from position: 93
2 jumps found. (Code = 43) Position 1 = 101, Position 2 = 103
Branch analysis from position: 101
1 jumps found. (Code = 42) Position 1 = 104
Branch analysis from position: 104
2 jumps found. (Code = 43) Position 1 = 112, Position 2 = 114
Branch analysis from position: 112
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
2 jumps found. (Code = 43) Position 1 = 123, Position 2 = 125
Branch analysis from position: 123
1 jumps found. (Code = 42) Position 1 = 126
Branch analysis from position: 126
2 jumps found. (Code = 43) Position 1 = 134, Position 2 = 136
Branch analysis from position: 134
1 jumps found. (Code = 42) Position 1 = 137
Branch analysis from position: 137
2 jumps found. (Code = 43) Position 1 = 145, Position 2 = 147
Branch analysis from position: 145
1 jumps found. (Code = 42) Position 1 = 148
Branch analysis from position: 148
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 147
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 136
2 jumps found. (Code = 43) Position 1 = 145, Position 2 = 147
Branch analysis from position: 145
Branch analysis from position: 147
Branch analysis from position: 125
2 jumps found. (Code = 43) Position 1 = 134, Position 2 = 136
Branch analysis from position: 134
Branch analysis from position: 136
Branch analysis from position: 114
2 jumps found. (Code = 43) Position 1 = 123, Position 2 = 125
Branch analysis from position: 123
Branch analysis from position: 125
Branch analysis from position: 103
2 jumps found. (Code = 43) Position 1 = 112, Position 2 = 114
Branch analysis from position: 112
Branch analysis from position: 114
Branch analysis from position: 92
2 jumps found. (Code = 43) Position 1 = 101, Position 2 = 103
Branch analysis from position: 101
Branch analysis from position: 103
Branch analysis from position: 81
2 jumps found. (Code = 43) Position 1 = 90, Position 2 = 92
Branch analysis from position: 90
Branch analysis from position: 92
Branch analysis from position: 69
2 jumps found. (Code = 43) Position 1 = 79, Position 2 = 81
Branch analysis from position: 79
Branch analysis from position: 81
Branch analysis from position: 59
2 jumps found. (Code = 43) Position 1 = 67, Position 2 = 69
Branch analysis from position: 67
Branch analysis from position: 69
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 59
Branch analysis from position: 57
Branch analysis from position: 59
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
Branch analysis from position: 49
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
Branch analysis from position: 39
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
Branch analysis from position: 29
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
Branch analysis from position: 19
filename:       /in/7n1li
function name:  (null)
number of ops:  151
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   10     1        ECHO                                                     '%2F%2F+Loose+checking%0A%0A'
   15     2        INIT_FCALL                                               'in_array'
          3        SEND_VAL                                                 null
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6      > JMPZ                                                     $2, ->9
          7    >   QM_ASSIGN                                        ~3      'true'
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~3      'false'
         10    >   CONCAT                                           ~4      ~3, '%0A'
         11        ECHO                                                     ~4
   16    12        INIT_FCALL                                               'in_array'
         13        SEND_VAL                                                 <false>
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $5      
         16      > JMPZ                                                     $5, ->19
         17    >   QM_ASSIGN                                        ~6      'true'
         18      > JMP                                                      ->20
         19    >   QM_ASSIGN                                        ~6      'false'
         20    >   CONCAT                                           ~7      ~6, '%0A'
         21        ECHO                                                     ~7
   17    22        INIT_FCALL                                               'in_array'
         23        SEND_VAL                                                 765
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                         $8      
         26      > JMPZ                                                     $8, ->29
         27    >   QM_ASSIGN                                        ~9      'true'
         28      > JMP                                                      ->30
         29    >   QM_ASSIGN                                        ~9      'false'
         30    >   CONCAT                                           ~10     ~9, '%0A'
         31        ECHO                                                     ~10
   18    32        INIT_FCALL                                               'in_array'
         33        SEND_VAL                                                 763
         34        SEND_VAR                                                 !0
         35        DO_ICALL                                         $11     
         36      > JMPZ                                                     $11, ->39
         37    >   QM_ASSIGN                                        ~12     'true'
         38      > JMP                                                      ->40
         39    >   QM_ASSIGN                                        ~12     'false'
         40    >   CONCAT                                           ~13     ~12, '%0A'
         41        ECHO                                                     ~13
   19    42        INIT_FCALL                                               'in_array'
         43        SEND_VAL                                                 'egg'
         44        SEND_VAR                                                 !0
         45        DO_ICALL                                         $14     
         46      > JMPZ                                                     $14, ->49
         47    >   QM_ASSIGN                                        ~15     'true'
         48      > JMP                                                      ->50
         49    >   QM_ASSIGN                                        ~15     'false'
         50    >   CONCAT                                           ~16     ~15, '%0A'
         51        ECHO                                                     ~16
   20    52        INIT_FCALL                                               'in_array'
         53        SEND_VAL                                                 'hhh'
         54        SEND_VAR                                                 !0
         55        DO_ICALL                                         $17     
         56      > JMPZ                                                     $17, ->59
         57    >   QM_ASSIGN                                        ~18     'true'
         58      > JMP                                                      ->60
         59    >   QM_ASSIGN                                        ~18     'false'
         60    >   CONCAT                                           ~19     ~18, '%0A'
         61        ECHO                                                     ~19
   21    62        INIT_FCALL                                               'in_array'
         63        SEND_VAL                                                 <array>
         64        SEND_VAR                                                 !0
         65        DO_ICALL                                         $20     
         66      > JMPZ                                                     $20, ->69
         67    >   QM_ASSIGN                                        ~21     'true'
         68      > JMP                                                      ->70
         69    >   QM_ASSIGN                                        ~21     'false'
         70    >   CONCAT                                           ~22     ~21, '%0A'
         71        ECHO                                                     ~22
   23    72        ECHO                                                     '%0A%0A%2F%2F+Strict+checking%0A%0A'
   25    73        INIT_FCALL                                               'in_array'
         74        SEND_VAL                                                 null
         75        SEND_VAR                                                 !0
         76        SEND_VAL                                                 <true>
         77        DO_ICALL                                         $23     
         78      > JMPZ                                                     $23, ->81
         79    >   QM_ASSIGN                                        ~24     'true'
         80      > JMP                                                      ->82
         81    >   QM_ASSIGN                                        ~24     'false'
         82    >   CONCAT                                           ~25     ~24, '%0A'
         83        ECHO                                                     ~25
   26    84        INIT_FCALL                                               'in_array'
         85        SEND_VAL                                                 <false>
         86        SEND_VAR                                                 !0
         87        SEND_VAL                                                 <true>
         88        DO_ICALL                                         $26     
         89      > JMPZ                                                     $26, ->92
         90    >   QM_ASSIGN                                        ~27     'true'
         91      > JMP                                                      ->93
         92    >   QM_ASSIGN                                        ~27     'false'
         93    >   CONCAT                                           ~28     ~27, '%0A'
         94        ECHO                                                     ~28
   27    95        INIT_FCALL                                               'in_array'
         96        SEND_VAL                                                 765
         97        SEND_VAR                                                 !0
         98        SEND_VAL                                                 <true>
         99        DO_ICALL                                         $29     
        100      > JMPZ                                                     $29, ->103
        101    >   QM_ASSIGN                                        ~30     'true'
        102      > JMP                                                      ->104
        103    >   QM_ASSIGN                                        ~30     'false'
        104    >   CONCAT                                           ~31     ~30, '%0A'
        105        ECHO                                                     ~31
   28   106        INIT_FCALL                                               'in_array'
        107        SEND_VAL                                                 763
        108        SEND_VAR                                                 !0
        109        SEND_VAL                                                 <true>
        110        DO_ICALL                                         $32     
        111      > JMPZ                                                     $32, ->114
        112    >   QM_ASSIGN                                        ~33     'true'
        113      > JMP                                                      ->115
        114    >   QM_ASSIGN                                        ~33     'false'
        115    >   CONCAT                                           ~34     ~33, '%0A'
        116        ECHO                                                     ~34
   29   117        INIT_FCALL                                               'in_array'
        118        SEND_VAL                                                 'egg'
        119        SEND_VAR                                                 !0
        120        SEND_VAL                                                 <true>
        121        DO_ICALL                                         $35     
        122      > JMPZ                                                     $35, ->125
        123    >   QM_ASSIGN                                        ~36     'true'
        124      > JMP                                                      ->126
        125    >   QM_ASSIGN                                        ~36     'false'
        126    >   CONCAT                                           ~37     ~36, '%0A'
        127        ECHO                                                     ~37
   30   128        INIT_FCALL                                               'in_array'
        129        SEND_VAL                                                 'hhh'
        130        SEND_VAR                                                 !0
        131        SEND_VAL                                                 <true>
        132        DO_ICALL                                         $38     
        133      > JMPZ                                                     $38, ->136
        134    >   QM_ASSIGN                                        ~39     'true'
        135      > JMP                                                      ->137
        136    >   QM_ASSIGN                                        ~39     'false'
        137    >   CONCAT                                           ~40     ~39, '%0A'
        138        ECHO                                                     ~40
   31   139        INIT_FCALL                                               'in_array'
        140        SEND_VAL                                                 <array>
        141        SEND_VAR                                                 !0
        142        SEND_VAL                                                 <true>
        143        DO_ICALL                                         $41     
        144      > JMPZ                                                     $41, ->147
        145    >   QM_ASSIGN                                        ~42     'true'
        146      > JMP                                                      ->148
        147    >   QM_ASSIGN                                        ~42     'false'
        148    >   CONCAT                                           ~43     ~42, '%0A'
        149        ECHO                                                     ~43
        150      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.6 ms | 1412 KiB | 15 Q