3v4l.org

run code in 300+ PHP versions simultaneously
<?php $orderDoc = array("ORT", "TRI", "CONT", "RMI"); $FindDoc= array("RMI0000191","ORT0000379","ORT0000391","ORT0000392","ORT0000390","CONT0000274","CONT0000275","RMI0000192","ORT0000391"); $result =[]; foreach($orderDoc as $doc){ $temp = preg_grep("/^". preg_quote($doc) . "/", $FindDoc); sort($temp); $result = array_merge($result, $temp); } var_dump($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 24
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 24
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/eqUBv
function name:  (null)
number of ops:  29
compiled vars:  !0 = $orderDoc, !1 = $FindDoc, !2 = $result, !3 = $doc, !4 = $temp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    7     2        ASSIGN                                                   !2, <array>
    8     3      > FE_RESET_R                                       $8      !0, ->24
          4    > > FE_FETCH_R                                               $8, !3, ->24
    9     5    >   INIT_FCALL                                               'preg_grep'
          6        INIT_FCALL                                               'preg_quote'
          7        SEND_VAR                                                 !3
          8        DO_ICALL                                         $9      
          9        CONCAT                                           ~10     '%2F%5E', $9
         10        CONCAT                                           ~11     ~10, '%2F'
         11        SEND_VAL                                                 ~11
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $12     
         14        ASSIGN                                                   !4, $12
   10    15        INIT_FCALL                                               'sort'
         16        SEND_REF                                                 !4
         17        DO_ICALL                                                 
   11    18        INIT_FCALL                                               'array_merge'
         19        SEND_VAR                                                 !2
         20        SEND_VAR                                                 !4
         21        DO_ICALL                                         $15     
         22        ASSIGN                                                   !2, $15
    8    23      > JMP                                                      ->4
         24    >   FE_FREE                                                  $8
   14    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142 ms | 1442 KiB | 18 Q