3v4l.org

run code in 300+ PHP versions simultaneously
<?php function highlightString($highlightString,$string) { if(strlen($highlightString)>0 && strlen($string)>0) { $s = $highlightString; $rest = $string; $result = $string; do { $rest = stristr($rest,$s); $replace = substr($rest,0,strlen($s)); $result = str_replace($replace,"<span class='textHighlight'>{$replace}</span>",$result); $rest = substr($rest,strlen($s)); } while ($rest !== false); return $result; } return $string; } echo highlightString("D&ouml;rsch","D&ouml;rsch");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/70be5
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'highlightstring'
          1        SEND_VAL                                                 'D%26ouml%3Brsch'
          2        SEND_VAL                                                 'D%26ouml%3Brsch'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function highlightstring:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 42
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 12
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/70be5
function name:  highlightString
number of ops:  44
compiled vars:  !0 = $highlightString, !1 = $string, !2 = $s, !3 = $rest, !4 = $result, !5 = $replace
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        STRLEN                                           ~6      !0
          3        IS_SMALLER                                       ~7      0, ~6
          4      > JMPZ_EX                                          ~7      ~7, ->8
          5    >   STRLEN                                           ~8      !1
          6        IS_SMALLER                                       ~9      0, ~8
          7        BOOL                                             ~7      ~9
          8    > > JMPZ                                                     ~7, ->42
    5     9    >   ASSIGN                                                   !2, !0
    6    10        ASSIGN                                                   !3, !1
    7    11        ASSIGN                                                   !4, !1
    9    12    >   INIT_FCALL                                               'stristr'
         13        SEND_VAR                                                 !3
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $13     
         16        ASSIGN                                                   !3, $13
   10    17        INIT_FCALL                                               'substr'
         18        SEND_VAR                                                 !3
         19        SEND_VAL                                                 0
         20        STRLEN                                           ~15     !2
         21        SEND_VAL                                                 ~15
         22        DO_ICALL                                         $16     
         23        ASSIGN                                                   !5, $16
   11    24        INIT_FCALL                                               'str_replace'
         25        SEND_VAR                                                 !5
         26        ROPE_INIT                                     3  ~19     '%3Cspan+class%3D%27textHighlight%27%3E'
         27        ROPE_ADD                                      1  ~19     ~19, !5
         28        ROPE_END                                      2  ~18     ~19, '%3C%2Fspan%3E'
         29        SEND_VAL                                                 ~18
         30        SEND_VAR                                                 !4
         31        DO_ICALL                                         $21     
         32        ASSIGN                                                   !4, $21
   12    33        INIT_FCALL                                               'substr'
         34        SEND_VAR                                                 !3
         35        STRLEN                                           ~23     !2
         36        SEND_VAL                                                 ~23
         37        DO_ICALL                                         $24     
         38        ASSIGN                                                   !3, $24
   13    39        TYPE_CHECK                                  1018          !3
         40      > JMPNZ                                                    ~26, ->12
   14    41    > > RETURN                                                   !4
   16    42    > > RETURN                                                   !1
   17    43*     > RETURN                                                   null

End of function highlightstring

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.99 ms | 1403 KiB | 20 Q