3v4l.org

run code in 300+ 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 = 24
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 24
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/DZFV4
function name:  (null)
number of ops:  26
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, ->24
          2    > > FE_FETCH_R                                               $4, !1, ->24
    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                                               'substr'
         10        INIT_FCALL                                               'round'
         11        FETCH_DIM_R                                      ~7      !2, 2
         12        CONCAT                                           ~8      '0.', ~7
         13        SEND_VAL                                                 ~8
         14        SEND_VAL                                                 3
         15        DO_ICALL                                         $9      
         16        SEND_VAR                                                 $9
         17        SEND_VAL                                                 2
         18        SEND_VAL                                                 3
         19        DO_ICALL                                         $10     
         20        CONCAT                                           ~11     ~6, $10
         21        CONCAT                                           ~12     ~11, '%0A'
         22        ECHO                                                     ~12
    5    23      > JMP                                                      ->2
         24    >   FE_FREE                                                  $4
    8    25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.89 ms | 1004 KiB | 16 Q