3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $val = '12.2'; if (is_int($val)) { echo true; } else if (is_string($val)) { if (! ctype_digit($val) && (! ctype_digit(substr($val, 1)) || substr($val, 0, 1) != "-")) { echo false; } } else { echo (is_double($val) && floor($val) == $val); } echo true;
based on d1Ftq
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
Jump found. Position 1 = 40
Branch analysis from position: 40
Jump found. Position 1 = -2
Branch analysis from position: 5
Jump found. Position 1 = 7, Position 2 = 32
Branch analysis from position: 7
Jump found. Position 1 = 12, Position 2 = 29
Branch analysis from position: 12
Jump found. Position 1 = 21, Position 2 = 28
Branch analysis from position: 21
Jump found. Position 1 = 30, Position 2 = 31
Branch analysis from position: 30
Jump found. Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 31
Branch analysis from position: 28
Branch analysis from position: 29
Branch analysis from position: 32
Jump found. Position 1 = 34, Position 2 = 39
Branch analysis from position: 34
Jump found. Position 1 = -2
Branch analysis from position: 39
filename:       /in/fYopM
function name:  (null)
number of ops:  42
compiled vars:  !0 = $val
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   ASSIGN                                                   !0, '12.2'
   3     1        TYPE_CHECK                                    4  ~2      !0
         2      > JMPZ                                                     ~2, ->5
   4     3    >   ECHO                                                     <true>
         4      > JMP                                                      ->40
   5     5    >   TYPE_CHECK                                    6  ~3      !0
         6      > JMPZ                                                     ~3, ->32
   6     7    >   INIT_FCALL                                               'ctype_digit'
         8        SEND_VAR                                                 !0
         9        DO_ICALL                                         $4      
        10        BOOL_NOT                                         ~5      $4
        11      > JMPZ_EX                                          ~5      ~5, ->29
        12    >   INIT_FCALL                                               'ctype_digit'
        13        INIT_FCALL                                               'substr'
        14        SEND_VAR                                                 !0
        15        SEND_VAL                                                 1
        16        DO_ICALL                                         $6      
        17        SEND_VAR                                                 $6
        18        DO_ICALL                                         $7      
        19        BOOL_NOT                                         ~8      $7
        20      > JMPNZ_EX                                         ~8      ~8, ->28
        21    >   INIT_FCALL                                               'substr'
        22        SEND_VAR                                                 !0
        23        SEND_VAL                                                 0
        24        SEND_VAL                                                 1
        25        DO_ICALL                                         $9      
        26        IS_NOT_EQUAL                                     ~10     $9, '-'
        27        BOOL                                             ~8      ~10
        28    >   BOOL                                             ~5      ~8
        29    > > JMPZ                                                     ~5, ->31
   7    30    >   ECHO                                                     <false>
        31    > > JMP                                                      ->40
  10    32    >   TYPE_CHECK                                    5  ~11     !0
        33      > JMPZ_EX                                          ~11     ~11, ->39
        34    >   INIT_FCALL                                               'floor'
        35        SEND_VAR                                                 !0
        36        DO_ICALL                                         $12     
        37        IS_EQUAL                                         ~13     $12, !0
        38        BOOL                                             ~11     ~13
        39    >   ECHO                                                     ~11
  12    40    >   ECHO                                                     <true>
        41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.2.0