3v4l.org

run code in 500+ PHP versions simultaneously
<?php namespace App\Util; class Regex { /** @return list<string> */ public static function match(string $pattern, string $subject): array { $matches = []; \Safe\preg_match($pattern, $subject, $matches); assert(is_array($matches)); return $matches; } public static function replace(string $pattern, string $replacement, string $subject, int $limit = -1): string { $result = \Safe\preg_replace($pattern, $replacement, $subject, $limit); assert(is_string($result)); // cannot be otherwise when the parameters are strings return $result; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oARtY
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E > > RETURN                                                       1

Class App\Util\Regex:
Function match:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oARtY
function name:  match
number of ops:  20
compiled vars:  !0 = $pattern, !1 = $subject, !2 = $matches
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   10     2        ASSIGN                                                       !2, <array>
   11     3        INIT_FCALL_BY_NAME                                           'Safe%5Cpreg_match'
          4        SEND_VAR_EX                                                  !0
          5        SEND_VAR_EX                                                  !1
          6        SEND_VAR_EX                                                  !2
          7        DO_FCALL                                          0          
   12     8        ASSERT_CHECK                                                 
          9        INIT_NS_FCALL_BY_NAME                                        'App%5CUtil%5Cassert'
         10        INIT_NS_FCALL_BY_NAME                                        'App%5CUtil%5Cis_array'
         11        SEND_VAR_EX                                                  !2
         12        DO_FCALL                                          0  $5      
         13        SEND_VAR_NO_REF_EX                                           $5
         14        SEND_VAL_EX                                                  'assert%28is_array%28%24matches%29%29'
         15        DO_FCALL                                          0          
   13    16        VERIFY_RETURN_TYPE                                           !2
         17      > RETURN                                                       !2
   14    18*       VERIFY_RETURN_TYPE                                           
         19*     > RETURN                                                       null

End of function match

Function replace:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oARtY
function name:  replace
number of ops:  23
compiled vars:  !0 = $pattern, !1 = $replacement, !2 = $subject, !3 = $limit, !4 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
          3        RECV_INIT                                            !3      -1
   18     4        INIT_FCALL_BY_NAME                                           'Safe%5Cpreg_replace'
          5        SEND_VAR_EX                                                  !0
          6        SEND_VAR_EX                                                  !1
          7        SEND_VAR_EX                                                  !2
          8        SEND_VAR_EX                                                  !3
          9        DO_FCALL                                          0  $5      
         10        ASSIGN                                                       !4, $5
   19    11        ASSERT_CHECK                                                 
         12        INIT_NS_FCALL_BY_NAME                                        'App%5CUtil%5Cassert'
         13        INIT_NS_FCALL_BY_NAME                                        'App%5CUtil%5Cis_string'
         14        SEND_VAR_EX                                                  !4
         15        DO_FCALL                                          0  $7      
         16        SEND_VAR_NO_REF_EX                                           $7
         17        SEND_VAL_EX                                                  'assert%28is_string%28%24result%29%29'
         18        DO_FCALL                                          0          
   20    19        VERIFY_RETURN_TYPE                                           !4
         20      > RETURN                                                       !4
   21    21*       VERIFY_RETURN_TYPE                                           
         22*     > RETURN                                                       null

End of function replace

End of class App\Util\Regex.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.4 ms | 766 KiB | 11 Q