3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NotAnInt { function __toString() { return " 1"; } } // the filter_* functions trim whitespace which can result in data loss var_dump(filter_var(" 1 ", FILTER_VALIDATE_INT)); // because filter_var casts passed values to a string, it accepts various unsafe values var_dump(filter_var(true, FILTER_VALIDATE_INT)); var_dump(filter_var(1.00000000000001, FILTER_VALIDATE_INT)); var_dump(filter_var(new NotAnInt(), FILTER_VALIDATE_INT));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ObLpV
function name:  (null)
number of ops:  32
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'notanint'
   10     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'filter_var'
          3        SEND_VAL                                                 '+++1++++'
          4        SEND_VAL                                                 257
          5        DO_ICALL                                         $0      
          6        SEND_VAR                                                 $0
          7        DO_ICALL                                                 
   13     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'filter_var'
         10        SEND_VAL                                                 <true>
         11        SEND_VAL                                                 257
         12        DO_ICALL                                         $2      
         13        SEND_VAR                                                 $2
         14        DO_ICALL                                                 
   14    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL                                               'filter_var'
         17        SEND_VAL                                                 1
         18        SEND_VAL                                                 257
         19        DO_ICALL                                         $4      
         20        SEND_VAR                                                 $4
         21        DO_ICALL                                                 
   15    22        INIT_FCALL                                               'var_dump'
         23        INIT_FCALL                                               'filter_var'
         24        NEW                                              $6      'NotAnInt'
         25        DO_FCALL                                      0          
         26        SEND_VAR                                                 $6
         27        SEND_VAL                                                 257
         28        DO_ICALL                                         $8      
         29        SEND_VAR                                                 $8
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Class NotAnInt:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ObLpV
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   '++1'
    6     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function __tostring

End of class NotAnInt.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.38 ms | 1447 KiB | 15 Q