3v4l.org

run code in 500+ 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 = 16
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 16
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 12
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/ZRpeU
function name:  (null)
number of ops:  18
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, ->16
          2    > > FE_FETCH_R                                                   $4, !1, ->16
    9     3    >   FRAMELESS_ICALL_3                preg_replace        ~5      '%2F%5Cd%2F', ''
          4        OP_DATA                                                      !1
          5        ASSIGN                                                       !2, ~5
   10     6        STRLEN                                               ~7      !2
          7        STRLEN                                               ~8      !1
          8        SUB                                                  ~9      ~8, 6
          9        IS_SMALLER_OR_EQUAL                                          ~7, ~9
         10      > JMPZ                                                         ~10, ->12
   11    11    >   ASSIGN                                                       !1, !2
   13    12    >   NOP                                                          
         13        FAST_CONCAT                                          ~12     !1, '%0A'
         14        ECHO                                                         ~12
    8    15      > JMP                                                          ->2
         16    >   FE_FREE                                                      $4
   14    17      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
189.18 ms | 2122 KiB | 13 Q