3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [1888.8861,1888.8851,1888.8841,1888.8881]; Foreach($arr as &$num){ $parts = str_split($num); If($parts[count($parts)-2]%2 ==0){ // Even $num = implode("",array_slice($parts,0,count($parts)-2)); }Else{ // Odd Echo $parts[count($parts)-3]+1; $num = implode("",array_slice($parts,0,count($parts)-3)).($parts[count($parts)-3]+1); } } Var_dump($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 49
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 49
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 26
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
filename:       /in/2ochB
function name:  (null)
number of ops:  54
compiled vars:  !0 = $arr, !1 = $num, !2 = $parts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1      > FE_RESET_RW                                      $4      !0, ->49
          2    > > FE_FETCH_RW                                              $4, !1, ->49
    6     3    >   INIT_FCALL                                               'str_split'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !2, $5
    7     7        COUNT                                            ~7      !2
          8        SUB                                              ~8      ~7, 2
          9        FETCH_DIM_R                                      ~9      !2, ~8
         10        MOD                                              ~10     ~9, 2
         11        IS_EQUAL                                                 ~10, 0
         12      > JMPZ                                                     ~11, ->26
    9    13    >   INIT_FCALL                                               'implode'
         14        SEND_VAL                                                 ''
         15        INIT_FCALL                                               'array_slice'
         16        SEND_VAR                                                 !2
         17        SEND_VAL                                                 0
         18        COUNT                                            ~12     !2
         19        SUB                                              ~13     ~12, 2
         20        SEND_VAL                                                 ~13
         21        DO_ICALL                                         $14     
         22        SEND_VAR                                                 $14
         23        DO_ICALL                                         $15     
         24        ASSIGN                                                   !1, $15
    7    25      > JMP                                                      ->48
   12    26    >   COUNT                                            ~17     !2
         27        SUB                                              ~18     ~17, 3
         28        FETCH_DIM_R                                      ~19     !2, ~18
         29        ADD                                              ~20     ~19, 1
         30        ECHO                                                     ~20
   13    31        INIT_FCALL                                               'implode'
         32        SEND_VAL                                                 ''
         33        INIT_FCALL                                               'array_slice'
         34        SEND_VAR                                                 !2
         35        SEND_VAL                                                 0
         36        COUNT                                            ~21     !2
         37        SUB                                              ~22     ~21, 3
         38        SEND_VAL                                                 ~22
         39        DO_ICALL                                         $23     
         40        SEND_VAR                                                 $23
         41        DO_ICALL                                         $24     
         42        COUNT                                            ~25     !2
         43        SUB                                              ~26     ~25, 3
         44        FETCH_DIM_R                                      ~27     !2, ~26
         45        ADD                                              ~28     ~27, 1
         46        CONCAT                                           ~29     $24, ~28
         47        ASSIGN                                                   !1, ~29
    5    48    > > JMP                                                      ->2
         49    >   FE_FREE                                                  $4
   16    50        INIT_FCALL                                               'var_dump'
         51        SEND_VAR                                                 !0
         52        DO_ICALL                                                 
         53      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
133.62 ms | 1008 KiB | 17 Q