3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'I loved you'; $from = 'love'; $to = 'lOvE'; var_dump($result1 = strtr($str, $from, $to)); var_dump($result2 = strtr($str, [$from[0] => $to[0], $from[1] => $to[1], $from[2] => $to[2], $from[3] => $to[3]])); var_dump($result2 = strtr($str, [$from => $to])); var_dump($result1===$result2);//false
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3rfuV
function name:  (null)
number of ops:  46
compiled vars:  !0 = $str, !1 = $from, !2 = $to, !3 = $result1, !4 = $result2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'I+loved+you'
    4     1        ASSIGN                                                   !1, 'love'
    5     2        ASSIGN                                                   !2, 'lOvE'
    7     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'strtr'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $8      
          9        ASSIGN                                           ~9      !3, $8
         10        SEND_VAL                                                 ~9
         11        DO_ICALL                                                 
    8    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'strtr'
         14        SEND_VAR                                                 !0
         15        FETCH_DIM_R                                      ~11     !1, 0
         16        FETCH_DIM_R                                      ~12     !2, 0
         17        INIT_ARRAY                                       ~13     ~12, ~11
         18        FETCH_DIM_R                                      ~14     !1, 1
         19        FETCH_DIM_R                                      ~15     !2, 1
         20        ADD_ARRAY_ELEMENT                                ~13     ~15, ~14
         21        FETCH_DIM_R                                      ~16     !1, 2
         22        FETCH_DIM_R                                      ~17     !2, 2
         23        ADD_ARRAY_ELEMENT                                ~13     ~17, ~16
         24        FETCH_DIM_R                                      ~18     !1, 3
         25        FETCH_DIM_R                                      ~19     !2, 3
         26        ADD_ARRAY_ELEMENT                                ~13     ~19, ~18
         27        SEND_VAL                                                 ~13
         28        DO_ICALL                                         $20     
         29        ASSIGN                                           ~21     !4, $20
         30        SEND_VAL                                                 ~21
         31        DO_ICALL                                                 
    9    32        INIT_FCALL                                               'var_dump'
         33        INIT_FCALL                                               'strtr'
         34        SEND_VAR                                                 !0
         35        INIT_ARRAY                                       ~23     !2, !1
         36        SEND_VAL                                                 ~23
         37        DO_ICALL                                         $24     
         38        ASSIGN                                           ~25     !4, $24
         39        SEND_VAL                                                 ~25
         40        DO_ICALL                                                 
   10    41        INIT_FCALL                                               'var_dump'
         42        IS_IDENTICAL                                     ~27     !3, !4
         43        SEND_VAL                                                 ~27
         44        DO_ICALL                                                 
         45      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.33 ms | 1400 KiB | 17 Q