3v4l.org

run code in 300+ PHP versions simultaneously
<?php //$lines = file('your_text_file.txt', FILE_IGNORE_NEW_LINES); $lines = [ '3M Company MMM', '99 Cents Only Stores NDN', 'AO Smith Corporation AOS', 'Aaron\'s, Inc. AAN', ]; foreach ($lines as $line) { [$names[], $symbols[]] = preg_split('~\s+(?=[A-Z]+$)~m', $line); } var_export($names); echo "\n---\n"; var_export($symbols); unset($names, $symbols); echo "\n***\n"; //$text = file_get_contents('your_text_file.txt'); $text = <<<TEXT 3M Company MMM 99 Cents Only Stores NDN AO Smith Corporation AOS Aaron's, Inc. AAN TEXT; preg_match_all('~(.+?)\s+([A-Z]+)$~m', $text, $matches, PREG_SET_ORDER); var_export(array_column($matches, 1)); echo "\n---\n"; var_export(array_column($matches, 2));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 15
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/5GYMW
function name:  (null)
number of ops:  49
compiled vars:  !0 = $lines, !1 = $line, !2 = $names, !3 = $symbols, !4 = $text, !5 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   11     1      > FE_RESET_R                                       $7      !0, ->15
          2    > > FE_FETCH_R                                               $7, !1, ->15
   12     3    >   INIT_FCALL                                               'preg_split'
          4        SEND_VAL                                                 '%7E%5Cs%2B%28%3F%3D%5BA-Z%5D%2B%24%29%7Em'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $8      
          7        FETCH_LIST_R                                     $9      $8, 0
          8        ASSIGN_DIM                                               !2
          9        OP_DATA                                                  $9
         10        FETCH_LIST_R                                     $11     $8, 1
         11        ASSIGN_DIM                                               !3
         12        OP_DATA                                                  $11
         13        FREE                                                     $8
   11    14      > JMP                                                      ->2
         15    >   FE_FREE                                                  $7
   14    16        INIT_FCALL                                               'var_export'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
   15    19        ECHO                                                     '%0A---%0A'
   16    20        INIT_FCALL                                               'var_export'
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                                 
   18    23        UNSET_CV                                                 !2
         24        UNSET_CV                                                 !3
   19    25        ECHO                                                     '%0A%2A%2A%2A%0A'
   22    26        ASSIGN                                                   !4, '3M+Company++++++MMM%0A99+Cents+Only+Stores++++NDN%0AAO+Smith+Corporation++++AOS%0AAaron%27s%2C+Inc.+++AAN'
   29    27        INIT_FCALL                                               'preg_match_all'
         28        SEND_VAL                                                 '%7E%28.%2B%3F%29%5Cs%2B%28%5BA-Z%5D%2B%29%24%7Em'
         29        SEND_VAR                                                 !4
         30        SEND_REF                                                 !5
         31        SEND_VAL                                                 2
         32        DO_ICALL                                                 
   30    33        INIT_FCALL                                               'var_export'
         34        INIT_FCALL                                               'array_column'
         35        SEND_VAR                                                 !5
         36        SEND_VAL                                                 1
         37        DO_ICALL                                         $17     
         38        SEND_VAR                                                 $17
         39        DO_ICALL                                                 
   31    40        ECHO                                                     '%0A---%0A'
   32    41        INIT_FCALL                                               'var_export'
         42        INIT_FCALL                                               'array_column'
         43        SEND_VAR                                                 !5
         44        SEND_VAL                                                 2
         45        DO_ICALL                                         $19     
         46        SEND_VAR                                                 $19
         47        DO_ICALL                                                 
         48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.85 ms | 1006 KiB | 17 Q