3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subject = "we went to see a ewe"; var_dump(str_replace(['e', 'w'], ['w', 'e'], $subject)); var_dump(str_replace([0 => 'e', 1 => 'w'], [0 => 'w', 1 => 'e'], $subject)); var_dump(preg_replace(['/e/', '/w/'], ['w', 'e'], $subject)); var_dump(preg_replace([0 => '/e/', 1 => '/w/'], [0 => 'w', 1 => 'e'], $subject));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gB8EL
function name:  (null)
number of ops:  34
compiled vars:  !0 = $subject
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'we+went+to+see+a+ewe'
    4     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'str_replace'
          3        SEND_VAL                                                 <array>
          4        SEND_VAL                                                 <array>
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                                 
    5     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'str_replace'
         11        SEND_VAL                                                 <array>
         12        SEND_VAL                                                 <array>
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $4      
         15        SEND_VAR                                                 $4
         16        DO_ICALL                                                 
    6    17        INIT_FCALL                                               'var_dump'
         18        INIT_FCALL                                               'preg_replace'
         19        SEND_VAL                                                 <array>
         20        SEND_VAL                                                 <array>
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $6      
         23        SEND_VAR                                                 $6
         24        DO_ICALL                                                 
    7    25        INIT_FCALL                                               'var_dump'
         26        INIT_FCALL                                               'preg_replace'
         27        SEND_VAL                                                 <array>
         28        SEND_VAL                                                 <array>
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                         $8      
         31        SEND_VAR                                                 $8
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.36 ms | 1396 KiB | 19 Q