3v4l.org

run code in 200+ PHP versions simultaneously
<?php // 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(new NotAnInt(), FILTER_VALIDATE_INT)); var_dump(filter_var(1.00000000000001, FILTER_VALIDATE_INT)); class NotAnInt { function __toString() { return " 1"; } }
based on OK3RF
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ESUbN
function name:  (null)
number of ops:  31
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   4     0  E >   INIT_FCALL                                               'var_dump'
         1        INIT_FCALL                                               'filter_var'
         2        SEND_VAL                                                 '+++1++++'
         3        SEND_VAL                                                 257
         4        DO_ICALL                                         $0      
         5        SEND_VAR                                                 $0
         6        DO_ICALL                                                 
   7     7        INIT_FCALL                                               'var_dump'
         8        INIT_FCALL                                               'filter_var'
         9        SEND_VAL                                                 <true>
        10        SEND_VAL                                                 257
        11        DO_ICALL                                         $2      
        12        SEND_VAR                                                 $2
        13        DO_ICALL                                                 
   8    14        INIT_FCALL                                               'var_dump'
        15        INIT_FCALL                                               'filter_var'
        16        NEW                                              $4      :35
        17        DO_FCALL                                      0          
        18        SEND_VAR                                                 $4
        19        SEND_VAL                                                 257
        20        DO_ICALL                                         $6      
        21        SEND_VAR                                                 $6
        22        DO_ICALL                                                 
   9    23        INIT_FCALL                                               'var_dump'
        24        INIT_FCALL                                               'filter_var'
        25        SEND_VAL                                                 1
        26        SEND_VAL                                                 257
        27        DO_ICALL                                         $8      
        28        SEND_VAR                                                 $8
        29        DO_ICALL                                                 
  15    30      > RETURN                                                   1

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

End of function __tostring

End of class NotAnInt.

Generated using Vulcan Logic Dumper, using php 7.4.0