3v4l.org

run code in 500+ 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 = 43
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 43
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 23
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
filename:       /in/2ochB
function name:  (null)
number of ops:  48
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, ->43
          2    > > FE_FETCH_RW                                                  $4, !1, ->43
    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, ->23
    9    13    >   INIT_FCALL                                                   'array_slice'
         14        SEND_VAR                                                     !2
         15        SEND_VAL                                                     0
         16        COUNT                                                ~12     !2
         17        SUB                                                  ~13     ~12, 2
         18        SEND_VAL                                                     ~13
         19        DO_ICALL                                             $14     
         20        FRAMELESS_ICALL_2                implode             ~15     '', $14
         21        ASSIGN                                                       !1, ~15
    7    22      > JMP                                                          ->42
   12    23    >   COUNT                                                ~17     !2
         24        SUB                                                  ~18     ~17, 3
         25        FETCH_DIM_R                                          ~19     !2, ~18
         26        ADD                                                  ~20     ~19, 1
         27        ECHO                                                         ~20
   13    28        INIT_FCALL                                                   'array_slice'
         29        SEND_VAR                                                     !2
         30        SEND_VAL                                                     0
         31        COUNT                                                ~21     !2
         32        SUB                                                  ~22     ~21, 3
         33        SEND_VAL                                                     ~22
         34        DO_ICALL                                             $23     
         35        FRAMELESS_ICALL_2                implode             ~24     '', $23
         36        COUNT                                                ~25     !2
         37        SUB                                                  ~26     ~25, 3
         38        FETCH_DIM_R                                          ~27     !2, ~26
         39        ADD                                                  ~28     ~27, 1
         40        CONCAT                                               ~29     ~24, ~28
         41        ASSIGN                                                       !1, ~29
    5    42    > > JMP                                                          ->2
         43    >   FE_FREE                                                      $4
   16    44        INIT_FCALL                                                   'var_dump'
         45        SEND_VAR                                                     !0
         46        DO_ICALL                                                     
         47      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.4 ms | 2204 KiB | 16 Q