3v4l.org

run code in 300+ PHP versions simultaneously
<?php function truthy($value){ return in_array($value, array(true,1,'y','yes','true'), true); } var_dump(truthy('n')); var_dump(truthy('yes')); var_dump(truthy('no')); var_dump(truthy('false')); var_dump(truthy(false));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D4GD5
function name:  (null)
number of ops:  31
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'truthy'
          2        SEND_VAL                                                 'n'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
    9     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'truthy'
          8        SEND_VAL                                                 'yes'
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
   10    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'truthy'
         14        SEND_VAL                                                 'no'
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
   11    18        INIT_FCALL                                               'var_dump'
         19        INIT_FCALL                                               'truthy'
         20        SEND_VAL                                                 'false'
         21        DO_FCALL                                      0  $6      
         22        SEND_VAR                                                 $6
         23        DO_ICALL                                                 
   12    24        INIT_FCALL                                               'var_dump'
         25        INIT_FCALL                                               'truthy'
         26        SEND_VAL                                                 <false>
         27        DO_FCALL                                      0  $8      
         28        SEND_VAR                                                 $8
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Function truthy:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D4GD5
function name:  truthy
number of ops:  8
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'in_array'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <array>
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $1      
          6      > RETURN                                                   $1
    5     7*     > RETURN                                                   null

End of function truthy

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.79 ms | 1399 KiB | 22 Q