3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isStringNumeric($value) { if (is_numeric($value)) { $integer = (int) $value; // Or use intval() $floatOrInteger = $value + 0; // Can also give a float, so watch it. } else { echo "$value is not numeric!" . PHP_EOL; } } isStringNumeric('15'); isStringNumeric('foo'); isStringNumeric('10.5'); isStringNumeric(15); isStringNumeric('-10'); isStringNumeric('');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j4Utb
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'isstringnumeric'
          1        SEND_VAL                                                 '15'
          2        DO_FCALL                                      0          
   13     3        INIT_FCALL                                               'isstringnumeric'
          4        SEND_VAL                                                 'foo'
          5        DO_FCALL                                      0          
   14     6        INIT_FCALL                                               'isstringnumeric'
          7        SEND_VAL                                                 '10.5'
          8        DO_FCALL                                      0          
   15     9        INIT_FCALL                                               'isstringnumeric'
         10        SEND_VAL                                                 15
         11        DO_FCALL                                      0          
   16    12        INIT_FCALL                                               'isstringnumeric'
         13        SEND_VAL                                                 '-10'
         14        DO_FCALL                                      0          
   17    15        INIT_FCALL                                               'isstringnumeric'
         16        SEND_VAL                                                 ''
         17        DO_FCALL                                      0          
         18      > RETURN                                                   1

Function isstringnumeric:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j4Utb
function name:  isStringNumeric
number of ops:  15
compiled vars:  !0 = $value, !1 = $integer, !2 = $floatOrInteger
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'is_numeric'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4      > JMPZ                                                     $3, ->10
    5     5    >   CAST                                          4  ~4      !0
          6        ASSIGN                                                   !1, ~4
    6     7        ADD                                              ~6      !0, 0
          8        ASSIGN                                                   !2, ~6
    4     9      > JMP                                                      ->14
    8    10    >   NOP                                                      
         11        FAST_CONCAT                                      ~8      !0, '+is+not+numeric%21'
         12        CONCAT                                           ~9      ~8, '%0A'
         13        ECHO                                                     ~9
   10    14    > > RETURN                                                   null

End of function isstringnumeric

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.51 ms | 1001 KiB | 20 Q