3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = [0.12345,0.012345,0.0001239,0.0001209]; Foreach($arr as $val){ Preg_match("/([0\.]+)([0-9]+)/", $val, $match); Echo $match[1]. Substr(round("0.".$match[2],3),2,3)."\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 21
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/DZFV4
function name:  (null)
number of ops:  23
compiled vars:  !0 = $arr, !1 = $val, !2 = $match
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    5     1      > FE_RESET_R                                           $4      !0, ->21
          2    > > FE_FETCH_R                                                   $4, !1, ->21
    6     3    >   INIT_FCALL                                                   'preg_match'
          4        SEND_VAL                                                     '%2F%28%5B0%5C.%5D%2B%29%28%5B0-9%5D%2B%29%2F'
          5        SEND_VAR                                                     !1
          6        SEND_REF                                                     !2
          7        DO_ICALL                                                     
    7     8        FETCH_DIM_R                                          ~6      !2, 1
          9        INIT_FCALL                                                   'round'
         10        FETCH_DIM_R                                          ~7      !2, 2
         11        CONCAT                                               ~8      '0.', ~7
         12        SEND_VAL                                                     ~8
         13        SEND_VAL                                                     3
         14        DO_ICALL                                             $9      
         15        FRAMELESS_ICALL_3                substr              ~10     $9, 2
         16        OP_DATA                                                      3
         17        CONCAT                                               ~11     ~6, ~10
         18        CONCAT                                               ~12     ~11, '%0A'
         19        ECHO                                                         ~12
    5    20      > JMP                                                          ->2
         21    >   FE_FREE                                                      $4
    8    22      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.23 ms | 2154 KiB | 15 Q