3v4l.org

run code in 300+ PHP versions simultaneously
<?php function amountType(string $amount): string { if (is_numeric($amount)) { if ((int) $amount == (float) $amount) { return "int"; } return "float"; } return "string"; } $amount1 = "99.9"; $amount2 = "99"; $amount3 = "NinetyNine"; echo $amount1 . ": " . amountType($amount1) . PHP_EOL; echo $amount2 . ": " . amountType($amount2) . PHP_EOL; echo $amount3 . ": " . amountType($amount3) . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K9XVB
function name:  (null)
number of ops:  25
compiled vars:  !0 = $amount1, !1 = $amount2, !2 = $amount3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, '99.9'
   16     1        ASSIGN                                                   !1, '99'
   17     2        ASSIGN                                                   !2, 'NinetyNine'
   19     3        CONCAT                                           ~6      !0, '%3A+'
          4        INIT_FCALL                                               'amounttype'
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $7      
          7        CONCAT                                           ~8      ~6, $7
          8        CONCAT                                           ~9      ~8, '%0A'
          9        ECHO                                                     ~9
   20    10        CONCAT                                           ~10     !1, '%3A+'
         11        INIT_FCALL                                               'amounttype'
         12        SEND_VAR                                                 !1
         13        DO_FCALL                                      0  $11     
         14        CONCAT                                           ~12     ~10, $11
         15        CONCAT                                           ~13     ~12, '%0A'
         16        ECHO                                                     ~13
   21    17        CONCAT                                           ~14     !2, '%3A+'
         18        INIT_FCALL                                               'amounttype'
         19        SEND_VAR                                                 !2
         20        DO_FCALL                                      0  $15     
         21        CONCAT                                           ~16     ~14, $15
         22        CONCAT                                           ~17     ~16, '%0A'
         23        ECHO                                                     ~17
   22    24      > RETURN                                                   1

Function amounttype:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K9XVB
function name:  amountType
number of ops:  14
compiled vars:  !0 = $amount
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                                         $1      
          4      > JMPZ                                                     $1, ->11
    5     5    >   CAST                                          4  ~2      !0
          6        CAST                                          5  ~3      !0
          7        IS_EQUAL                                                 ~2, ~3
          8      > JMPZ                                                     ~4, ->10
    6     9    > > RETURN                                                   'int'
    9    10    > > RETURN                                                   'float'
   12    11    > > RETURN                                                   'string'
   13    12*       VERIFY_RETURN_TYPE                                       
         13*     > RETURN                                                   null

End of function amounttype

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.29 ms | 1012 KiB | 17 Q