3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_numerics ($str) { $matches = array(); preg_match("/\[([^]]*)\]/", $str, $matches); $matches = preg_replace("/[^0-9]/", '', $str); return ($matches); } $one = 'SP1-SP200'; print_r(get_numerics($one));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7kK5Q
function name:  (null)
number of ops:  8
compiled vars:  !0 = $one
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, 'SP1-SP200'
   12     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'get_numerics'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function get_numerics:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7kK5Q
function name:  get_numerics
number of ops:  15
compiled vars:  !0 = $str, !1 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAL                                                 '%2F%5C%5B%28%5B%5E%5D%5D%2A%29%5C%5D%2F'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !1
          6        DO_ICALL                                                 
    6     7        INIT_FCALL                                               'preg_replace'
          8        SEND_VAL                                                 '%2F%5B%5E0-9%5D%2F'
          9        SEND_VAL                                                 ''
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $4      
         12        ASSIGN                                                   !1, $4
    7    13      > RETURN                                                   !1
    8    14*     > RETURN                                                   null

End of function get_numerics

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.68 ms | 1398 KiB | 20 Q