3v4l.org

run code in 300+ PHP versions simultaneously
<?php $exception = ['will not be'=>'will&nbs;pnot&nbs;pbe', 'will not' => 'will&nbs;pnot']; $string = 'They will not begin'; function f($string, $exception){ $newString = strtr($string, $exception); $array = explode(' ', $newString); if( $string !== $newString){ $array = array_combine(array_values($array), array_values($array)); var_dump(array_intersect_key($array, array_flip($exception))); $array = array_replace($array, array_intersect_key($array, array_flip($exception))); } return array_values($array); } var_dump(f($string, $exception)); var_dump(f('Will I love?', $exception)); var_dump(f('I will love.', $exception)); var_dump(f('I will not love.', $exception)); var_dump(f('Do I love?', $exception));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GDQU4
function name:  (null)
number of ops:  38
compiled vars:  !0 = $exception, !1 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 'They+will+not+begin'
   17     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'f'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   18     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'f'
         11        SEND_VAL                                                 'Will+I+love%3F'
         12        SEND_VAR                                                 !0
         13        DO_FCALL                                      0  $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                                 
   19    16        INIT_FCALL                                               'var_dump'
         17        INIT_FCALL                                               'f'
         18        SEND_VAL                                                 'I+will+love.'
         19        SEND_VAR                                                 !0
         20        DO_FCALL                                      0  $8      
         21        SEND_VAR                                                 $8
         22        DO_ICALL                                                 
   20    23        INIT_FCALL                                               'var_dump'
         24        INIT_FCALL                                               'f'
         25        SEND_VAL                                                 'I+will+not+love.'
         26        SEND_VAR                                                 !0
         27        DO_FCALL                                      0  $10     
         28        SEND_VAR                                                 $10
         29        DO_ICALL                                                 
   21    30        INIT_FCALL                                               'var_dump'
         31        INIT_FCALL                                               'f'
         32        SEND_VAL                                                 'Do+I+love%3F'
         33        SEND_VAR                                                 !0
         34        DO_FCALL                                      0  $12     
         35        SEND_VAR                                                 $12
         36        DO_ICALL                                                 
         37      > RETURN                                                   1

Function f:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 47
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
filename:       /in/GDQU4
function name:  f
number of ops:  52
compiled vars:  !0 = $string, !1 = $exception, !2 = $newString, !3 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'strtr'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !2, $4
    8     7        INIT_FCALL                                               'explode'
          8        SEND_VAL                                                 '+'
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                         $6      
         11        ASSIGN                                                   !3, $6
    9    12        IS_NOT_IDENTICAL                                         !0, !2
         13      > JMPZ                                                     ~8, ->47
   10    14    >   INIT_FCALL                                               'array_combine'
         15        INIT_FCALL                                               'array_values'
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                         $9      
         18        SEND_VAR                                                 $9
         19        INIT_FCALL                                               'array_values'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                         $10     
         22        SEND_VAR                                                 $10
         23        DO_ICALL                                         $11     
         24        ASSIGN                                                   !3, $11
   11    25        INIT_FCALL                                               'var_dump'
         26        INIT_FCALL                                               'array_intersect_key'
         27        SEND_VAR                                                 !3
         28        INIT_FCALL                                               'array_flip'
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                         $13     
         31        SEND_VAR                                                 $13
         32        DO_ICALL                                         $14     
         33        SEND_VAR                                                 $14
         34        DO_ICALL                                                 
   12    35        INIT_FCALL                                               'array_replace'
         36        SEND_VAR                                                 !3
         37        INIT_FCALL                                               'array_intersect_key'
         38        SEND_VAR                                                 !3
         39        INIT_FCALL                                               'array_flip'
         40        SEND_VAR                                                 !1
         41        DO_ICALL                                         $16     
         42        SEND_VAR                                                 $16
         43        DO_ICALL                                         $17     
         44        SEND_VAR                                                 $17
         45        DO_ICALL                                         $18     
         46        ASSIGN                                                   !3, $18
   14    47    >   INIT_FCALL                                               'array_values'
         48        SEND_VAR                                                 !3
         49        DO_ICALL                                         $20     
         50      > RETURN                                                   $20
   15    51*     > RETURN                                                   null

End of function f

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.52 ms | 1407 KiB | 34 Q