3v4l.org

run code in 300+ PHP versions simultaneously
<?php $names = array('joe123456', 'joe123', '1joe1234', '123joe456'); foreach ($names as $name) { $new_name = preg_replace('/\d/', '', $name); if (strlen($new_name) <= strlen($name) - 6) { $name = $new_name; } echo "$name\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 19
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 19
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 15
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/ZRpeU
function name:  (null)
number of ops:  21
compiled vars:  !0 = $names, !1 = $name, !2 = $new_name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1      > FE_RESET_R                                       $4      !0, ->19
          2    > > FE_FETCH_R                                               $4, !1, ->19
    9     3    >   INIT_FCALL                                               'preg_replace'
          4        SEND_VAL                                                 '%2F%5Cd%2F'
          5        SEND_VAL                                                 ''
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !2, $5
   10     9        STRLEN                                           ~7      !2
         10        STRLEN                                           ~8      !1
         11        SUB                                              ~9      ~8, 6
         12        IS_SMALLER_OR_EQUAL                                      ~7, ~9
         13      > JMPZ                                                     ~10, ->15
   11    14    >   ASSIGN                                                   !1, !2
   13    15    >   NOP                                                      
         16        FAST_CONCAT                                      ~12     !1, '%0A'
         17        ECHO                                                     ~12
    8    18      > JMP                                                      ->2
         19    >   FE_FREE                                                  $4
   14    20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.29 ms | 989 KiB | 14 Q