3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'aaa 3', 'bbb 15', 'ccccc 3A', 'dddd 2412', 'eee fff 15', 'ggg 612', 'hhh iiiii 23B', ]; $regex = '#(?<word>\D+)\s(?<number>.+)#'; $results = []; foreach ($array as $line) { preg_match($regex, $line, $matches); $results[$matches['word']] = $matches['number']; } var_dump($results);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/t2tMd
function name:  (null)
number of ops:  20
compiled vars:  !0 = $array, !1 = $regex, !2 = $results, !3 = $line, !4 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, '%23%28%3F%3Cword%3E%5CD%2B%29%5Cs%28%3F%3Cnumber%3E.%2B%29%23'
   14     2        ASSIGN                                                   !2, <array>
   16     3      > FE_RESET_R                                       $8      !0, ->15
          4    > > FE_FETCH_R                                               $8, !3, ->15
   17     5    >   INIT_FCALL                                               'preg_match'
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !3
          8        SEND_REF                                                 !4
          9        DO_ICALL                                                 
   18    10        FETCH_DIM_R                                      ~10     !4, 'word'
         11        FETCH_DIM_R                                      ~12     !4, 'number'
         12        ASSIGN_DIM                                               !2, ~10
         13        OP_DATA                                                  ~12
   16    14      > JMP                                                      ->4
         15    >   FE_FREE                                                  $8
   21    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
134.88 ms | 1399 KiB | 17 Q