3v4l.org

run code in 500+ 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[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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hAZrS
function name:  (null)
number of ops:  43
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                                                     
   13     3        INIT_FCALL                                                   'x'
          4        SEND_VAL                                                     '-12.32'
          5        DO_FCALL                                          0          
   14     6        INIT_FCALL                                                   'x'
          7        SEND_VAL                                                     '32'
          8        DO_FCALL                                          0          
   15     9        INIT_FCALL                                                   'x'
         10        SEND_VAL                                                     '3231.432'
         11        DO_FCALL                                          0          
   16    12        INIT_FCALL                                                   'x'
         13        SEND_VAL                                                     '-34.0'
         14        DO_FCALL                                          0          
   17    15        INIT_FCALL                                                   'x'
         16        SEND_VAL                                                     '023'
         17        DO_FCALL                                          0          
   18    18        INIT_FCALL                                                   'x'
         19        SEND_VAL                                                     '00324.230'
         20        DO_FCALL                                          0          
   19    21        INIT_FCALL                                                   'x'
         22        SEND_VAL                                                     '10'
         23        DO_FCALL                                          0          
   20    24        INIT_FCALL                                                   'x'
         25        SEND_VAL                                                     '00.3'
         26        DO_FCALL                                          0          
   21    27        INIT_FCALL                                                   'x'
         28        SEND_VAL                                                     '0'
         29        DO_FCALL                                          0          
   22    30        INIT_FCALL                                                   'x'
         31        SEND_VAL                                                     '-0'
         32        DO_FCALL                                          0          
   23    33        INIT_FCALL                                                   'x'
         34        SEND_VAL                                                     '-0.0'
         35        DO_FCALL                                          0          
   24    36        INIT_FCALL                                                   'x'
         37        SEND_VAL                                                     '-04.8330'
         38        DO_FCALL                                          0          
   25    39        INIT_FCALL                                                   'x'
         40        SEND_VAL                                                     '-000000000012345678901234567890000.000012345678901234567890000'
         41        DO_FCALL                                          0          
         42      > RETURN                                                       1

Function x:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 39
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
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 = 40
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
Branch analysis from position: 33
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 39
Branch analysis from position: 24
Branch analysis from position: 39
filename:       /in/hAZrS
function name:  x
number of ops:  44
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        FETCH_DIM_R                                          ~6      !1, 1
          6        ASSIGN                                               ~7      !3, ~6
          7        FETCH_DIM_R                                          ~8      ~7, 0
          8        IS_EQUAL                                                     ~8, '-'
          9      > JMPZ                                                         ~9, ->15
         10    >   FRAMELESS_ICALL_2                trim                ~10     !3, '-'
         11        ASSIGN                                               ~11     !3, ~10
         12        ASSIGN                                               ~12     !4, ~11
         13        QM_ASSIGN                                            ~13     ~12
         14      > JMP                                                          ->16
         15    >   QM_ASSIGN                                            ~13     !3
         16    >   FRAMELESS_ICALL_2                trim                ~14     ~13, 0
         17        ASSIGN                                               ~15     !2, ~14
         18        SEND_VAL                                                     ~15
         19        DO_ICALL                                             $16     
         20        FETCH_DIM_R                                          ~17     $16, 1
         21        STRLEN                                               ~18     ~17
         22        IS_NOT_IDENTICAL                                             !2, !3
         23      > JMPZ                                                         ~19, ->39
         24    > > JMPZ                                                         !4, ->27
         25    >   QM_ASSIGN                                            ~20     '+-'
         26      > JMP                                                          ->28
         27    >   QM_ASSIGN                                            ~20     '+'
         28    >   FETCH_DIM_R                                          ~21     !2, 0
         29        IS_EQUAL                                                     ~21, '.'
         30      > JMPZ                                                         ~22, ->33
         31    >   QM_ASSIGN                                            ~23     0
         32      > JMP                                                          ->34
         33    >   QM_ASSIGN                                            ~23     ''
         34    >   CONCAT                                               ~24     ~20, ~23
         35        FRAMELESS_ICALL_2                trim                ~25     !2, '.'
         36        CONCAT                                               ~26     ~24, ~25
         37        QM_ASSIGN                                            ~27     ~26
         38      > JMP                                                          ->40
         39    >   QM_ASSIGN                                            ~27     ''
         40    >   CONCAT                                               ~28     ~18, ~27
         41        ECHO                                                         ~28
   10    42        ECHO                                                         '%0A'
   11    43      > RETURN                                                       null

End of function x

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.89 ms | 2335 KiB | 28 Q