3v4l.org

run code in 300+ PHP versions simultaneously
<?php function testdata($data) { $emptyValue = "null"; $trueValue = "ok"; $falseValue = "nok"; $trueArray = array(1,'1',true,'true','yes' ); $falseArray = array(0,'0',false,'false','no' ); 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/90tc0
function name:  (null)
number of ops:  55
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'testdata'
          2        SEND_VAL                                                 <false>
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   19     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'testdata'
          8        SEND_VAL                                                 <true>
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
   20    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'testdata'
         14        SEND_VAL                                                 'true'
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
   21    18        INIT_FCALL                                               'var_dump'
         19        INIT_FCALL                                               'testdata'
         20        SEND_VAL                                                 'false'
         21        DO_FCALL                                      0  $6      
         22        SEND_VAR                                                 $6
         23        DO_ICALL                                                 
   22    24        INIT_FCALL                                               'var_dump'
         25        INIT_FCALL                                               'testdata'
         26        SEND_VAL                                                 'yes'
         27        DO_FCALL                                      0  $8      
         28        SEND_VAR                                                 $8
         29        DO_ICALL                                                 
   23    30        INIT_FCALL                                               'var_dump'
         31        INIT_FCALL                                               'testdata'
         32        SEND_VAL                                                 'no'
         33        DO_FCALL                                      0  $10     
         34        SEND_VAR                                                 $10
         35        DO_ICALL                                                 
   24    36        INIT_FCALL                                               'var_dump'
         37        INIT_FCALL                                               'testdata'
         38        SEND_VAL                                                 ''
         39        DO_FCALL                                      0  $12     
         40        SEND_VAR                                                 $12
         41        DO_ICALL                                                 
   25    42        INIT_FCALL                                               'var_dump'
         43        INIT_FCALL                                               'testdata'
         44        SEND_VAL                                                 1
         45        DO_FCALL                                      0  $14     
         46        SEND_VAR                                                 $14
         47        DO_ICALL                                                 
   26    48        INIT_FCALL                                               'var_dump'
         49        INIT_FCALL                                               'testdata'
         50        SEND_VAL                                                 0
         51        DO_FCALL                                      0  $16     
         52        SEND_VAR                                                 $16
         53        DO_ICALL                                                 
         54      > 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/90tc0
function name:  testdata
number of ops:  24
compiled vars:  !0 = $data, !1 = $emptyValue, !2 = $trueValue, !3 = $falseValue, !4 = $trueArray, !5 = $falseArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, 'null'
    4     2        ASSIGN                                                   !2, 'ok'
    5     3        ASSIGN                                                   !3, 'nok'
    6     4        ASSIGN                                                   !4, <array>
    7     5        ASSIGN                                                   !5, <array>
    9     6        INIT_FCALL                                               'in_array'
          7        SEND_VAR                                                 !0
          8        SEND_VAR                                                 !4
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $11     
         11      > JMPZ                                                     $11, ->14
   10    12    > > RETURN                                                   !2
         13*       JMP                                                      ->23
   11    14    >   INIT_FCALL                                               'in_array'
         15        SEND_VAR                                                 !0
         16        SEND_VAR                                                 !5
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $12     
         19      > JMPZ                                                     $12, ->22
   12    20    > > RETURN                                                   !3
         21*       JMP                                                      ->23
   14    22    > > RETURN                                                   !1
   16    23*     > RETURN                                                   null

End of function testdata

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.58 ms | 1403 KiB | 26 Q