3v4l.org

run code in 300+ PHP versions simultaneously
<?php $chat = <<<CHAT <Amanda> Hi there, how are you? <Jack> Hi, im fine <Paul> sup yall <Petra> wasabi <Paul> shall we go for beers? <Petra> most definitely <Jack> see you later CHAT; preg_match_all( '/^<((?!Amanda>|Jack>)[^>]+)> \K.+/m', $chat, $matches, PREG_SET_ORDER ); $result = []; foreach ($matches as [$words, $name]) { $result[$name] = ($result[$name] ?? 0) + str_word_count($words); } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 25
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 25
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/iskZB
function name:  (null)
number of ops:  30
compiled vars:  !0 = $chat, !1 = $matches, !2 = $result, !3 = $words, !4 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3CAmanda%3E+Hi+there%2C+how+are+you%3F%0A%3CJack%3E+Hi%2C+im+fine+%0A%3CPaul%3E+sup+yall%0A%3CPetra%3E+wasabi%0A%3CPaul%3E+shall+we+go+for+beers%3F%0A%3CPetra%3E+most+definitely%0A%3CJack%3E+see+you+later'
   13     1        INIT_FCALL                                               'preg_match_all'
   14     2        SEND_VAL                                                 '%2F%5E%3C%28%28%3F%21Amanda%3E%7CJack%3E%29%5B%5E%3E%5D%2B%29%3E+%5CK.%2B%2Fm'
   15     3        SEND_VAR                                                 !0
   16     4        SEND_REF                                                 !1
   17     5        SEND_VAL                                                 2
   13     6        DO_ICALL                                                 
   19     7        ASSIGN                                                   !2, <array>
   20     8      > FE_RESET_R                                       $8      !1, ->25
          9    > > FE_FETCH_R                                               $8, $9, ->25
         10    >   FETCH_LIST_R                                     $10     $9, 0
         11        ASSIGN                                                   !3, $10
         12        FETCH_LIST_R                                     $12     $9, 1
         13        ASSIGN                                                   !4, $12
         14        FREE                                                     $9
   21    15        FETCH_DIM_IS                                     ~15     !2, !4
         16        COALESCE                                         ~16     ~15
         17        QM_ASSIGN                                        ~16     0
         18        INIT_FCALL                                               'str_word_count'
         19        SEND_VAR                                                 !3
         20        DO_ICALL                                         $17     
         21        ADD                                              ~18     ~16, $17
         22        ASSIGN_DIM                                               !2, !4
         23        OP_DATA                                                  ~18
   20    24      > JMP                                                      ->9
         25    >   FE_FREE                                                  $8
   23    26        INIT_FCALL                                               'var_export'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.3 ms | 1001 KiB | 16 Q