3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'Some Text', 'Some Other Text (+£14.20)', 'Foo', 'Text Text (+£26.88)', 'Another One (+£68.04)', ]; $result = []; foreach ($array as $v) { $result += preg_match("/(.+) \(\+£([^)]+)\)/", $v, $m) ? [$m[1] => (float) $m[2]] : [$v => 0]; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 20
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/VIv4k
function name:  (null)
number of ops:  25
compiled vars:  !0 = $array, !1 = $result, !2 = $v, !3 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   12     2      > FE_RESET_R                                       $6      !0, ->20
          3    > > FE_FETCH_R                                               $6, !2, ->20
   13     4    >   INIT_FCALL                                               'preg_match'
          5        SEND_VAL                                                 '%2F%28.%2B%29+%5C%28%5C%2B%C2%A3%28%5B%5E%29%5D%2B%29%5C%29%2F'
          6        SEND_VAR                                                 !2
          7        SEND_REF                                                 !3
          8        DO_ICALL                                         $7      
          9      > JMPZ                                                     $7, ->16
         10    >   FETCH_DIM_R                                      ~8      !3, 1
         11        FETCH_DIM_R                                      ~9      !3, 2
         12        CAST                                          5  ~10     ~9
         13        INIT_ARRAY                                       ~11     ~10, ~8
         14        QM_ASSIGN                                        ~12     ~11
         15      > JMP                                                      ->18
         16    >   INIT_ARRAY                                       ~13     0, !2
         17        QM_ASSIGN                                        ~12     ~13
         18    >   ASSIGN_OP                                     1          !1, ~12
   12    19      > JMP                                                      ->3
         20    >   FE_FREE                                                  $6
   15    21        INIT_FCALL                                               'var_export'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.82 ms | 1002 KiB | 15 Q