3v4l.org

run code in 300+ PHP versions simultaneously
<?php $emptyValue = "null"; $trueValue = "ok"; $falseValue = "nok"; $trueArray = [ 1,'1',true,'true','yes' ]; $falseArray = [ 0,'0',false,'false','no' ]; function testdata($data) { global $trueArray, $falseArray, $emptyValue, $trueValue, $falseValue; if( in_array($data, $trueArray, true) ) { return $trueValue; } elseif( in_array($data, $falseArray, true) ) { return $falseValue; } else { return $emptyValue; } } var_dump(testdata(false)); var_dump(testdata(true)); var_dump(testdata('true')); var_dump(testdata('false')); var_dump(testdata('yes')); var_dump(testdata('no')); var_dump(testdata('')); var_dump(testdata(1)); var_dump(testdata(0));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1Uqjr
function name:  (null)
number of ops:  60
compiled vars:  !0 = $emptyValue, !1 = $trueValue, !2 = $falseValue, !3 = $trueArray, !4 = $falseArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'null'
    3     1        ASSIGN                                                   !1, 'ok'
    4     2        ASSIGN                                                   !2, 'nok'
    6     3        ASSIGN                                                   !3, <array>
    7     4        ASSIGN                                                   !4, <array>
   21     5        INIT_FCALL                                               'var_dump'
          6        INIT_FCALL                                               'testdata'
          7        SEND_VAL                                                 <false>
          8        DO_FCALL                                      0  $10     
          9        SEND_VAR                                                 $10
         10        DO_ICALL                                                 
   22    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'testdata'
         13        SEND_VAL                                                 <true>
         14        DO_FCALL                                      0  $12     
         15        SEND_VAR                                                 $12
         16        DO_ICALL                                                 
   23    17        INIT_FCALL                                               'var_dump'
         18        INIT_FCALL                                               'testdata'
         19        SEND_VAL                                                 'true'
         20        DO_FCALL                                      0  $14     
         21        SEND_VAR                                                 $14
         22        DO_ICALL                                                 
   24    23        INIT_FCALL                                               'var_dump'
         24        INIT_FCALL                                               'testdata'
         25        SEND_VAL                                                 'false'
         26        DO_FCALL                                      0  $16     
         27        SEND_VAR                                                 $16
         28        DO_ICALL                                                 
   25    29        INIT_FCALL                                               'var_dump'
         30        INIT_FCALL                                               'testdata'
         31        SEND_VAL                                                 'yes'
         32        DO_FCALL                                      0  $18     
         33        SEND_VAR                                                 $18
         34        DO_ICALL                                                 
   26    35        INIT_FCALL                                               'var_dump'
         36        INIT_FCALL                                               'testdata'
         37        SEND_VAL                                                 'no'
         38        DO_FCALL                                      0  $20     
         39        SEND_VAR                                                 $20
         40        DO_ICALL                                                 
   27    41        INIT_FCALL                                               'var_dump'
         42        INIT_FCALL                                               'testdata'
         43        SEND_VAL                                                 ''
         44        DO_FCALL                                      0  $22     
         45        SEND_VAR                                                 $22
         46        DO_ICALL                                                 
   28    47        INIT_FCALL                                               'var_dump'
         48        INIT_FCALL                                               'testdata'
         49        SEND_VAL                                                 1
         50        DO_FCALL                                      0  $24     
         51        SEND_VAR                                                 $24
         52        DO_ICALL                                                 
   29    53        INIT_FCALL                                               'var_dump'
         54        INIT_FCALL                                               'testdata'
         55        SEND_VAL                                                 0
         56        DO_FCALL                                      0  $26     
         57        SEND_VAR                                                 $26
         58        DO_ICALL                                                 
         59      > RETURN                                                   1

Function testdata:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1Uqjr
function name:  testdata
number of ops:  24
compiled vars:  !0 = $data, !1 = $trueArray, !2 = $falseArray, !3 = $emptyValue, !4 = $trueValue, !5 = $falseValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        BIND_GLOBAL                                              !1, 'trueArray'
          2        BIND_GLOBAL                                              !2, 'falseArray'
          3        BIND_GLOBAL                                              !3, 'emptyValue'
          4        BIND_GLOBAL                                              !4, 'trueValue'
          5        BIND_GLOBAL                                              !5, 'falseValue'
   12     6        INIT_FCALL                                               'in_array'
          7        SEND_VAR                                                 !0
          8        SEND_VAR                                                 !1
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $6      
         11      > JMPZ                                                     $6, ->14
   13    12    > > RETURN                                                   !4
         13*       JMP                                                      ->23
   14    14    >   INIT_FCALL                                               'in_array'
         15        SEND_VAR                                                 !0
         16        SEND_VAR                                                 !2
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $7      
         19      > JMPZ                                                     $7, ->22
   15    20    > > RETURN                                                   !5
         21*       JMP                                                      ->23
   17    22    > > RETURN                                                   !3
   19    23*     > RETURN                                                   null

End of function testdata

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.75 ms | 1407 KiB | 26 Q