3v4l.org

run code in 500+ PHP versions simultaneously
<?php $strings = [ "123A.478", "123.48", "123AX", "--123.46", "123A-.46", "-123--.46", "A-123-.46" ]; $pattern = '/^[^\d\s]+(?=-)|[^\d\s.]+(?!\d)/'; foreach ($strings as $str) { echo preg_replace($pattern, "", $str) . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/75G2T
function name:  (null)
number of ops:  11
compiled vars:  !0 = $strings, !1 = $pattern, !2 = $str
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   13     1        ASSIGN                                                       !1, '%2F%5E%5B%5E%5Cd%5Cs%5D%2B%28%3F%3D-%29%7C%5B%5E%5Cd%5Cs.%5D%2B%28%3F%21%5Cd%29%2F'
   15     2      > FE_RESET_R                                           $5      !0, ->9
          3    > > FE_FETCH_R                                                   $5, !2, ->9
   16     4    >   FRAMELESS_ICALL_3                preg_replace        ~6      !1, ''
          5        OP_DATA                                                      !2
          6        CONCAT                                               ~7      ~6, '%0A'
          7        ECHO                                                         ~7
   15     8      > JMP                                                          ->3
          9    >   FE_FREE                                                      $5
   17    10      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.99 ms | 1878 KiB | 13 Q