3v4l.org

run code in 300+ PHP versions simultaneously
<?php $msg1 = <<<_STR Hi X Blah Kind regards ABC _STR; $msg2 = <<<_STR Hi Y Blah Regards CBA _STR; foreach ([$msg1, $msg2] as $message) { $found = trim(preg_split('/^.*regards$/im', $message, 2)[0]); echo 'Found: "', $found, '"', PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 21
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 21
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/idMcP
function name:  (null)
number of ops:  23
compiled vars:  !0 = $msg1, !1 = $msg2, !2 = $message, !3 = $found
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Hi+X%0A%0ABlah%0A%0AKind+regards%0AABC'
   12     1        ASSIGN                                                   !1, 'Hi+Y%0A%0ABlah%0A%0ARegards%0ACBA'
   21     2        INIT_ARRAY                                       ~6      !0
          3        ADD_ARRAY_ELEMENT                                ~6      !1
          4      > FE_RESET_R                                       $7      ~6, ->21
          5    > > FE_FETCH_R                                               $7, !2, ->21
   22     6    >   INIT_FCALL                                               'trim'
          7        INIT_FCALL                                               'preg_split'
          8        SEND_VAL                                                 '%2F%5E.%2Aregards%24%2Fim'
          9        SEND_VAR                                                 !2
         10        SEND_VAL                                                 2
         11        DO_ICALL                                         $8      
         12        FETCH_DIM_R                                      ~9      $8, 0
         13        SEND_VAL                                                 ~9
         14        DO_ICALL                                         $10     
         15        ASSIGN                                                   !3, $10
   23    16        ECHO                                                     'Found%3A+%22'
         17        ECHO                                                     !3
         18        ECHO                                                     '%22'
         19        ECHO                                                     '%0A'
   21    20      > JMP                                                      ->5
         21    >   FE_FREE                                                  $7
   24    22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.01 ms | 1395 KiB | 17 Q