3v4l.org

run code in 300+ PHP versions simultaneously
<?php $argv[1] = '-040.010'; $argv[1] = '-0000100.123400000'; #$_=$argv[1];$t=trim('-'==$_[0]?$n=$_=trim($_,'-'):$_,0); $t=trim('-'==($_=$argv[1])[0]?$n=$_=trim($_,'-'):$_,0); $R = explode('.',$t); echo strlen($R[1]).($t!==$_?($n?' -':' ').$t:'');
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 39
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 35
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 39
Branch analysis from position: 32
Branch analysis from position: 39
filename:       /in/E7vDd
function name:  (null)
number of ops:  43
compiled vars:  !0 = $argv, !1 = $t, !2 = $_, !3 = $n, !4 = $R
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN_DIM                                               !0, 1
          1        OP_DATA                                                  '-040.010'
    4     2        ASSIGN_DIM                                               !0, 1
          3        OP_DATA                                                  '-0000100.123400000'
    7     4        INIT_FCALL                                               'trim'
          5        FETCH_DIM_R                                      ~7      !0, 1
          6        ASSIGN                                           ~8      !2, ~7
          7        FETCH_DIM_R                                      ~9      ~8, 0
          8        IS_EQUAL                                                 ~9, '-'
          9      > JMPZ                                                     ~10, ->18
         10    >   INIT_FCALL                                               'trim'
         11        SEND_VAR                                                 !2
         12        SEND_VAL                                                 '-'
         13        DO_ICALL                                         $11     
         14        ASSIGN                                           ~12     !2, $11
         15        ASSIGN                                           ~13     !3, ~12
         16        QM_ASSIGN                                        ~14     ~13
         17      > JMP                                                      ->19
         18    >   QM_ASSIGN                                        ~14     !2
         19    >   SEND_VAL                                                 ~14
         20        SEND_VAL                                                 0
         21        DO_ICALL                                         $15     
         22        ASSIGN                                                   !1, $15
    9    23        INIT_FCALL                                               'explode'
         24        SEND_VAL                                                 '.'
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                         $17     
         27        ASSIGN                                                   !4, $17
   11    28        FETCH_DIM_R                                      ~19     !4, 1
         29        STRLEN                                           ~20     ~19
         30        IS_NOT_IDENTICAL                                         !1, !2
         31      > JMPZ                                                     ~21, ->39
         32    > > JMPZ                                                     !3, ->35
         33    >   QM_ASSIGN                                        ~22     '+-'
         34      > JMP                                                      ->36
         35    >   QM_ASSIGN                                        ~22     '+'
         36    >   CONCAT                                           ~23     ~22, !1
         37        QM_ASSIGN                                        ~24     ~23
         38      > JMP                                                      ->40
         39    >   QM_ASSIGN                                        ~24     ''
         40    >   CONCAT                                           ~25     ~20, ~24
         41        ECHO                                                     ~25
         42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.71 ms | 1400 KiB | 17 Q