3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = "This is a test"; $search = "is"; $pos = 0; $loop = true; while($loop) { # Check if the word can be found in the text $pos = stripos($return,$needle,$pos); if($pos !== false) { $spanStart = "<span style='background-color:khaki;'>"; $spanEnd = "</span>"; $return = substr($return,0,$pos) . $spanStart . substr($return,$pos,strlen($needle)) . $spanEnd . substr($return,$pos+strlen($needle),strlen($return)); $pos = $pos + strlen($needle) + strlen($spanStart) + strlen($spanEnd); } else { $loop = false; } } echo "html=[$html]";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 5
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 47
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 5
Branch analysis from position: 49
Branch analysis from position: 5
filename:       /in/r1AiE
function name:  (null)
number of ops:  54
compiled vars:  !0 = $html, !1 = $search, !2 = $pos, !3 = $loop, !4 = $return, !5 = $needle, !6 = $spanStart, !7 = $spanEnd
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'This+is+a+test'
    4     1        ASSIGN                                                   !1, 'is'
    6     2        ASSIGN                                                   !2, 0
    7     3        ASSIGN                                                   !3, <true>
    8     4      > JMP                                                      ->48
   11     5    >   INIT_FCALL                                               'stripos'
          6        SEND_VAR                                                 !4
          7        SEND_VAR                                                 !5
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                         $12     
         10        ASSIGN                                                   !2, $12
   12    11        TYPE_CHECK                                  1018          !2
         12      > JMPZ                                                     ~14, ->47
   13    13    >   ASSIGN                                                   !6, '%3Cspan+style%3D%27background-color%3Akhaki%3B%27%3E'
   14    14        ASSIGN                                                   !7, '%3C%2Fspan%3E'
   15    15        INIT_FCALL                                               'substr'
         16        SEND_VAR                                                 !4
         17        SEND_VAL                                                 0
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                         $17     
         20        CONCAT                                           ~18     $17, !6
         21        INIT_FCALL                                               'substr'
         22        SEND_VAR                                                 !4
         23        SEND_VAR                                                 !2
         24        STRLEN                                           ~19     !5
         25        SEND_VAL                                                 ~19
         26        DO_ICALL                                         $20     
         27        CONCAT                                           ~21     ~18, $20
         28        CONCAT                                           ~22     ~21, !7
         29        INIT_FCALL                                               'substr'
         30        SEND_VAR                                                 !4
         31        STRLEN                                           ~23     !5
         32        ADD                                              ~24     !2, ~23
         33        SEND_VAL                                                 ~24
         34        STRLEN                                           ~25     !4
         35        SEND_VAL                                                 ~25
         36        DO_ICALL                                         $26     
         37        CONCAT                                           ~27     ~22, $26
         38        ASSIGN                                                   !4, ~27
   16    39        STRLEN                                           ~29     !5
         40        ADD                                              ~30     !2, ~29
         41        STRLEN                                           ~31     !6
         42        ADD                                              ~32     ~30, ~31
         43        STRLEN                                           ~33     !7
         44        ADD                                              ~34     ~32, ~33
         45        ASSIGN                                                   !2, ~34
         46      > JMP                                                      ->48
   18    47    >   ASSIGN                                                   !3, <false>
    8    48    > > JMPNZ                                                    !3, ->5
   22    49    >   ROPE_INIT                                     3  ~38     'html%3D%5B'
         50        ROPE_ADD                                      1  ~38     ~38, !0
         51        ROPE_END                                      2  ~37     ~38, '%5D'
         52        ECHO                                                     ~37
         53      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.52 ms | 1405 KiB | 17 Q