3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_numerics ($str) { $matches = array(); $pattern = '/(?:$|[$])\s*\d+(?:\.\d{2})?/'; if (preg_match($pattern, $string, $matches)) { return $matches[0]; } } $one = 'Producto de prueba 16gb \n $100 - Buenos Aires, Argentina\n \n Algun texto de un producto'; print_r(get_numerics($one));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tFreK
function name:  (null)
number of ops:  8
compiled vars:  !0 = $one
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, 'Producto+de+prueba+16gb+%5Cn%0A++++++++%24100+-+Buenos+Aires%2C+Argentina%5Cn%0A++++++++%5Cn%0A++++++++Algun+texto+de+un+producto'
   17     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
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tFreK
function name:  get_numerics
number of ops:  12
compiled vars:  !0 = $str, !1 = $matches, !2 = $pattern, !3 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, '%2F%28%3F%3A%24%7C%5B%24%5D%29%5Cs%2A%5Cd%2B%28%3F%3A%5C.%5Cd%7B2%7D%29%3F%2F'
    6     3        INIT_FCALL                                               'preg_match'
          4        SEND_VAR                                                 !2
          5        SEND_VAR                                                 !3
          6        SEND_REF                                                 !1
          7        DO_ICALL                                         $6      
          8      > JMPZ                                                     $6, ->11
    7     9    >   FETCH_DIM_R                                      ~7      !1, 0
         10      > RETURN                                                   ~7
    9    11    > > RETURN                                                   null

End of function get_numerics

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.45 ms | 1398 KiB | 18 Q