3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subject = "Мама мыла раму, дочь чертила пентаграмму"; $array = array( 'Мама', 'Мама мыла', 'Мама мыла раму', 'Мама мыла раму, дочь', 'Мама мыла раму, дочь чертила', ); usort($array, function($a, $b){return strlen($b) - strlen($a);}); $array_pattern = array(); foreach ($array as $value) { $array_pattern[] = "#^{$value}#i"; } $result = preg_replace($array_pattern, '', $subject); echo $result;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/3kaHo
function name:  (null)
number of ops:  25
compiled vars:  !0 = $subject, !1 = $array, !2 = $array_pattern, !3 = $value, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%D0%9C%D0%B0%D0%BC%D0%B0+%D0%BC%D1%8B%D0%BB%D0%B0+%D1%80%D0%B0%D0%BC%D1%83%2C+%D0%B4%D0%BE%D1%87%D1%8C+%D1%87%D0%B5%D1%80%D1%82%D0%B8%D0%BB%D0%B0+%D0%BF%D0%B5%D0%BD%D1%82%D0%B0%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D1%83'
    5     1        ASSIGN                                                   !1, <array>
   13     2        INIT_FCALL                                               'usort'
          3        SEND_REF                                                 !1
          4        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
          5        SEND_VAL                                                 ~7
          6        DO_ICALL                                                 
   15     7        ASSIGN                                                   !2, <array>
   17     8      > FE_RESET_R                                       $10     !1, ->16
          9    > > FE_FETCH_R                                               $10, !3, ->16
   18    10    >   ROPE_INIT                                     3  ~13     '%23%5E'
         11        ROPE_ADD                                      1  ~13     ~13, !3
         12        ROPE_END                                      2  ~12     ~13, '%23i'
         13        ASSIGN_DIM                                               !2
         14        OP_DATA                                                  ~12
   17    15      > JMP                                                      ->9
         16    >   FE_FREE                                                  $10
   21    17        INIT_FCALL                                               'preg_replace'
         18        SEND_VAR                                                 !2
         19        SEND_VAL                                                 ''
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                         $15     
         22        ASSIGN                                                   !4, $15
   23    23        ECHO                                                     !4
         24      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3kaHo
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        STRLEN                                           ~2      !1
          3        STRLEN                                           ~3      !0
          4        SUB                                              ~4      ~2, ~3
          5      > RETURN                                                   ~4
          6*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
280.43 ms | 1017 KiB | 15 Q