3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(0); function x($v){ $argv[1] = $v; echo strlen((explode('.',$t=trim('-'==($_=$argv[1])[0]?$n=$_=trim($_,'-'):$_,0)))[1]).($t!==$_?($n?' -':' ').$t:''); echo "\n"; echo strlen((explode('.',$t=trim('-'==($_=$argv[1])[0]?$n=$_=trim($_,'-'):$_,0)))[1]).($t!==$_?($n?' -':' ').('.'==$t[0]?0:'').$t:''); echo "\n"; } x('-12.32'); x('32'); x('3231.432'); x('-34.0'); x('023'); x('00324.230'); x('10'); x('00.3'); x('0'); x('-0'); x('-04.8330'); x('-000000000012345678901234567890000.000012345678901234567890000');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T846U
function name:  (null)
number of ops:  40
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 0
          2        DO_ICALL                                                 
   15     3        INIT_FCALL                                               'x'
          4        SEND_VAL                                                 '-12.32'
          5        DO_FCALL                                      0          
   16     6        INIT_FCALL                                               'x'
          7        SEND_VAL                                                 '32'
          8        DO_FCALL                                      0          
   17     9        INIT_FCALL                                               'x'
         10        SEND_VAL                                                 '3231.432'
         11        DO_FCALL                                      0          
   18    12        INIT_FCALL                                               'x'
         13        SEND_VAL                                                 '-34.0'
         14        DO_FCALL                                      0          
   19    15        INIT_FCALL                                               'x'
         16        SEND_VAL                                                 '023'
         17        DO_FCALL                                      0          
   20    18        INIT_FCALL                                               'x'
         19        SEND_VAL                                                 '00324.230'
         20        DO_FCALL                                      0          
   21    21        INIT_FCALL                                               'x'
         22        SEND_VAL                                                 '10'
         23        DO_FCALL                                      0          
   22    24        INIT_FCALL                                               'x'
         25        SEND_VAL                                                 '00.3'
         26        DO_FCALL                                      0          
   23    27        INIT_FCALL                                               'x'
         28        SEND_VAL                                                 '0'
         29        DO_FCALL                                      0          
   24    30        INIT_FCALL                                               'x'
         31        SEND_VAL                                                 '-0'
         32        DO_FCALL                                      0          
   25    33        INIT_FCALL                                               'x'
         34        SEND_VAL                                                 '-04.8330'
         35        DO_FCALL                                      0          
   26    36        INIT_FCALL                                               'x'
         37        SEND_VAL                                                 '-000000000012345678901234567890000.000012345678901234567890000'
         38        DO_FCALL                                      0          
         39      > RETURN                                                   1

Function x:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 37
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 57
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 43) Position 1 = 68, Position 2 = 82
Branch analysis from position: 68
2 jumps found. (Code = 43) Position 1 = 69, Position 2 = 71
Branch analysis from position: 69
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
2 jumps found. (Code = 43) Position 1 = 75, Position 2 = 77
Branch analysis from position: 75
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
1 jumps found. (Code = 42) Position 1 = 83
Branch analysis from position: 83
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 77
1 jumps found. (Code = 42) Position 1 = 83
Branch analysis from position: 83
Branch analysis from position: 71
2 jumps found. (Code = 43) Position 1 = 75, Position 2 = 77
Branch analysis from position: 75
Branch analysis from position: 77
Branch analysis from position: 82
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 68, Position 2 = 82
Branch analysis from position: 68
Branch analysis from position: 82
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 57
Branch analysis from position: 49
Branch analysis from position: 57
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 37
Branch analysis from position: 30
Branch analysis from position: 37
filename:       /in/T846U
function name:  x
number of ops:  87
compiled vars:  !0 = $v, !1 = $argv, !2 = $t, !3 = $_, !4 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_DIM                                               !1, 1
          2        OP_DATA                                                  !0
    8     3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '.'
          5        INIT_FCALL                                               'trim'
          6        FETCH_DIM_R                                      ~6      !1, 1
          7        ASSIGN                                           ~7      !3, ~6
          8        FETCH_DIM_R                                      ~8      ~7, 0
          9        IS_EQUAL                                                 ~8, '-'
         10      > JMPZ                                                     ~9, ->19
         11    >   INIT_FCALL                                               'trim'
         12        SEND_VAR                                                 !3
         13        SEND_VAL                                                 '-'
         14        DO_ICALL                                         $10     
         15        ASSIGN                                           ~11     !3, $10
         16        ASSIGN                                           ~12     !4, ~11
         17        QM_ASSIGN                                        ~13     ~12
         18      > JMP                                                      ->20
         19    >   QM_ASSIGN                                        ~13     !3
         20    >   SEND_VAL                                                 ~13
         21        SEND_VAL                                                 0
         22        DO_ICALL                                         $14     
         23        ASSIGN                                           ~15     !2, $14
         24        SEND_VAL                                                 ~15
         25        DO_ICALL                                         $16     
         26        FETCH_DIM_R                                      ~17     $16, 1
         27        STRLEN                                           ~18     ~17
         28        IS_NOT_IDENTICAL                                         !2, !3
         29      > JMPZ                                                     ~19, ->37
         30    > > JMPZ                                                     !4, ->33
         31    >   QM_ASSIGN                                        ~20     '+-'
         32      > JMP                                                      ->34
         33    >   QM_ASSIGN                                        ~20     '+'
         34    >   CONCAT                                           ~21     ~20, !2
         35        QM_ASSIGN                                        ~22     ~21
         36      > JMP                                                      ->38
         37    >   QM_ASSIGN                                        ~22     ''
         38    >   CONCAT                                           ~23     ~18, ~22
         39        ECHO                                                     ~23
    9    40        ECHO                                                     '%0A'
   10    41        INIT_FCALL                                               'explode'
         42        SEND_VAL                                                 '.'
         43        INIT_FCALL                                               'trim'
         44        FETCH_DIM_R                                      ~24     !1, 1
         45        ASSIGN                                           ~25     !3, ~24
         46        FETCH_DIM_R                                      ~26     ~25, 0
         47        IS_EQUAL                                                 ~26, '-'
         48      > JMPZ                                                     ~27, ->57
         49    >   INIT_FCALL                                               'trim'
         50        SEND_VAR                                                 !3
         51        SEND_VAL                                                 '-'
         52        DO_ICALL                                         $28     
         53        ASSIGN                                           ~29     !3, $28
         54        ASSIGN                                           ~30     !4, ~29
         55        QM_ASSIGN                                        ~31     ~30
         56      > JMP                                                      ->58
         57    >   QM_ASSIGN                                        ~31     !3
         58    >   SEND_VAL                                                 ~31
         59        SEND_VAL                                                 0
         60        DO_ICALL                                         $32     
         61        ASSIGN                                           ~33     !2, $32
         62        SEND_VAL                                                 ~33
         63        DO_ICALL                                         $34     
         64        FETCH_DIM_R                                      ~35     $34, 1
         65        STRLEN                                           ~36     ~35
         66        IS_NOT_IDENTICAL                                         !2, !3
         67      > JMPZ                                                     ~37, ->82
         68    > > JMPZ                                                     !4, ->71
         69    >   QM_ASSIGN                                        ~38     '+-'
         70      > JMP                                                      ->72
         71    >   QM_ASSIGN                                        ~38     '+'
         72    >   FETCH_DIM_R                                      ~39     !2, 0
         73        IS_EQUAL                                                 ~39, '.'
         74      > JMPZ                                                     ~40, ->77
         75    >   QM_ASSIGN                                        ~41     0
         76      > JMP                                                      ->78
         77    >   QM_ASSIGN                                        ~41     ''
         78    >   CONCAT                                           ~42     ~38, ~41
         79        CONCAT                                           ~43     ~42, !2
         80        QM_ASSIGN                                        ~44     ~43
         81      > JMP                                                      ->83
         82    >   QM_ASSIGN                                        ~44     ''
         83    >   CONCAT                                           ~45     ~36, ~44
         84        ECHO                                                     ~45
   12    85        ECHO                                                     '%0A'
   13    86      > RETURN                                                   null

End of function x

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
205.94 ms | 1410 KiB | 31 Q