3v4l.org

run code in 300+ PHP versions simultaneously
<?php $argv[1] = '-0000100.123400000'; echo '-'==($_=$argv[1])[0]?$n=$_=trim($_,'-'):$_; echo $_=$argv[1]!=$n=trim($_,'-')?$n:$_; exit; error_reporting(0); function x($v){ $argv[1] = $v; echo strlen((explode('.',$t=trim('-'==($_=$argv[1])[0]?$n=$_=trim($_,'-'):$_,0)))[1]).($t!==$_?($n?' -':' ').('.'==$t[0]?0:'').trim($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('-0.0'); x('-04.8330'); x('-000000000012345678901234567890000.000012345678901234567890000');
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
Branch analysis from position: 25
filename:       /in/TfO0i
function name:  (null)
number of ops:  74
compiled vars:  !0 = $argv, !1 = $_, !2 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN_DIM                                               !0, 1
          1        OP_DATA                                                  '-0000100.123400000'
    7     2        FETCH_DIM_R                                      ~4      !0, 1
          3        ASSIGN                                           ~5      !1, ~4
          4        FETCH_DIM_R                                      ~6      ~5, 0
          5        IS_EQUAL                                                 ~6, '-'
          6      > JMPZ                                                     ~7, ->15
          7    >   INIT_FCALL                                               'trim'
          8        SEND_VAR                                                 !1
          9        SEND_VAL                                                 '-'
         10        DO_ICALL                                         $8      
         11        ASSIGN                                           ~9      !1, $8
         12        ASSIGN                                           ~10     !2, ~9
         13        QM_ASSIGN                                        ~11     ~10
         14      > JMP                                                      ->16
         15    >   QM_ASSIGN                                        ~11     !1
         16    >   ECHO                                                     ~11
    9    17        FETCH_DIM_R                                      ~12     !0, 1
         18        INIT_FCALL                                               'trim'
         19        SEND_VAR                                                 !1
         20        SEND_VAL                                                 '-'
         21        DO_ICALL                                         $13     
         22      > JMPZ                                                     $13, ->25
         23    >   QM_ASSIGN                                        ~14     !2
         24      > JMP                                                      ->26
         25    >   QM_ASSIGN                                        ~14     !1
         26    >   ASSIGN                                           ~15     !2, ~14
         27        IS_NOT_EQUAL                                     ~16     ~12, ~15
         28        ASSIGN                                           ~17     !1, ~16
         29        ECHO                                                     ~17
   13    30      > EXIT                                                     
   15    31*       INIT_FCALL                                               'error_reporting'
         32*       SEND_VAL                                                 0
         33*       DO_ICALL                                                 
   25    34*       INIT_FCALL                                               'x'
         35*       SEND_VAL                                                 '-12.32'
         36*       DO_FCALL                                      0          
   26    37*       INIT_FCALL                                               'x'
         38*       SEND_VAL                                                 '32'
         39*       DO_FCALL                                      0          
   27    40*       INIT_FCALL                                               'x'
         41*       SEND_VAL                                                 '3231.432'
         42*       DO_FCALL                                      0          
   28    43*       INIT_FCALL                                               'x'
         44*       SEND_VAL                                                 '-34.0'
         45*       DO_FCALL                                      0          
   29    46*       INIT_FCALL                                               'x'
         47*       SEND_VAL                                                 '023'
         48*       DO_FCALL                                      0          
   30    49*       INIT_FCALL                                               'x'
         50*       SEND_VAL                                                 '00324.230'
         51*       DO_FCALL                                      0          
   31    52*       INIT_FCALL                                               'x'
         53*       SEND_VAL                                                 '10'
         54*       DO_FCALL                                      0          
   32    55*       INIT_FCALL                                               'x'
         56*       SEND_VAL                                                 '00.3'
         57*       DO_FCALL                                      0          
   33    58*       INIT_FCALL                                               'x'
         59*       SEND_VAL                                                 '0'
         60*       DO_FCALL                                      0          
   34    61*       INIT_FCALL                                               'x'
         62*       SEND_VAL                                                 '-0'
         63*       DO_FCALL                                      0          
   35    64*       INIT_FCALL                                               'x'
         65*       SEND_VAL                                                 '-0.0'
         66*       DO_FCALL                                      0          
   36    67*       INIT_FCALL                                               'x'
         68*       SEND_VAL                                                 '-04.8330'
         69*       DO_FCALL                                      0          
   37    70*       INIT_FCALL                                               'x'
         71*       SEND_VAL                                                 '-000000000012345678901234567890000.000012345678901234567890000'
         72*       DO_FCALL                                      0          
         73*     > 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 = 48
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
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
Branch analysis from position: 39
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 48
Branch analysis from position: 30
Branch analysis from position: 48
filename:       /in/TfO0i
function name:  x
number of ops:  53
compiled vars:  !0 = $v, !1 = $argv, !2 = $t, !3 = $_, !4 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        ASSIGN_DIM                                               !1, 1
          2        OP_DATA                                                  !0
   20     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, ->48
         30    > > JMPZ                                                     !4, ->33
         31    >   QM_ASSIGN                                        ~20     '+-'
         32      > JMP                                                      ->34
         33    >   QM_ASSIGN                                        ~20     '+'
         34    >   FETCH_DIM_R                                      ~21     !2, 0
         35        IS_EQUAL                                                 ~21, '.'
         36      > JMPZ                                                     ~22, ->39
         37    >   QM_ASSIGN                                        ~23     0
         38      > JMP                                                      ->40
         39    >   QM_ASSIGN                                        ~23     ''
         40    >   CONCAT                                           ~24     ~20, ~23
         41        INIT_FCALL                                               'trim'
         42        SEND_VAR                                                 !2
         43        SEND_VAL                                                 '.'
         44        DO_ICALL                                         $25     
         45        CONCAT                                           ~26     ~24, $25
         46        QM_ASSIGN                                        ~27     ~26
         47      > JMP                                                      ->49
         48    >   QM_ASSIGN                                        ~27     ''
         49    >   CONCAT                                           ~28     ~18, ~27
         50        ECHO                                                     ~28
   22    51        ECHO                                                     '%0A'
   23    52      > RETURN                                                   null

End of function x

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.65 ms | 1411 KiB | 32 Q