3v4l.org

run code in 300+ PHP versions simultaneously
<?php $name1 = 'The cat is red and wet'; $name2 = 'The cat is green and wet'; function stringDiff($string1, $string2) { $x = str_split($string1); $y = str_split($string2); $diff = array_diff($x, $y); foreach ($diff as $letter) { $string1 = str_replace($letter, '-', $string1); } return $string1; } var_dump(stringDiff($name1, $name2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LZ2bX
function name:  (null)
number of ops:  10
compiled vars:  !0 = $name1, !1 = $name2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'The+cat+is+red+and+wet'
    4     1        ASSIGN                                                   !1, 'The+cat+is+green+and+wet'
   17     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'stringdiff'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function stringdiff:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 24
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 24
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/LZ2bX
function name:  stringDiff
number of ops:  27
compiled vars:  !0 = $string1, !1 = $string2, !2 = $x, !3 = $y, !4 = $diff, !5 = $letter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        INIT_FCALL                                               'str_split'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !2, $6
    9     6        INIT_FCALL                                               'str_split'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !3, $8
   10    10        INIT_FCALL                                               'array_diff'
         11        SEND_VAR                                                 !2
         12        SEND_VAR                                                 !3
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !4, $10
   11    15      > FE_RESET_R                                       $12     !4, ->24
         16    > > FE_FETCH_R                                               $12, !5, ->24
   12    17    >   INIT_FCALL                                               'str_replace'
         18        SEND_VAR                                                 !5
         19        SEND_VAL                                                 '-'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                         $13     
         22        ASSIGN                                                   !0, $13
   11    23      > JMP                                                      ->16
         24    >   FE_FREE                                                  $12
   14    25      > RETURN                                                   !0
   15    26*     > RETURN                                                   null

End of function stringdiff

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
184.44 ms | 948 KiB | 23 Q