3v4l.org

run code in 300+ PHP versions simultaneously
<?php $mysql_result[0]['id']="1"; $mysql_result[1]['id']="2"; $mysql_result[2]['id']="3"; $mysql_result[0]['address']="www.example.com/page1"; $mysql_result[1]['address']="www.example.com/page2"; $mysql_result[2]['address']="www.example.com/page3"; $mysql_result[0]['title']="Page 1"; $mysql_result[1]['title']="Page 2"; $mysql_result[2]['title']="Page 3"; $mysql_result[0]['content']="The quick dog jumps over the lazy dog."; $mysql_result[1]['content']="The best thing about morning is breakfast."; $mysql_result[2]['content']="Hotdogs are great ballpark food."; $mysql_result[0]['image']="image1.jpg"; $mysql_result[1]['image']="image2.jpg"; $mysql_result[2]['image']="image3.jpg"; $query="dog"; foreach($mysql_result as $a_row) { $content = str_replace($query,"my_un1qu3_r3pl4c3m3nt_".$query,$a_row['content']); $occurences = explode("my_un1qu3_r3pl4c3m3nt_",$content); if(count($occurences)>1) { foreach($occurences as $results) { $content=$results['content']; echo '<li class="media"> <a class="pull-left" href="'.$results['address'].'"> <img class="media-object thumbnail" src="'.$results['image'].'" style="height:100px !important"> </a> <div class="media-body"> <h4 class="media-heading"><a href="'.$results['address'].'">'.$results['title'].'</a></h4> <p>...'.str_replace($query,'<strong>'.$query.'</strong>', substr($content,strpos($content,$query)-25,160)).'...</p> </div> </li>'; } } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 47, Position 2 = 103
Branch analysis from position: 47
2 jumps found. (Code = 78) Position 1 = 48, Position 2 = 103
Branch analysis from position: 48
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 102
Branch analysis from position: 64
2 jumps found. (Code = 77) Position 1 = 65, Position 2 = 101
Branch analysis from position: 65
2 jumps found. (Code = 78) Position 1 = 66, Position 2 = 101
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
Branch analysis from position: 101
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
Branch analysis from position: 101
Branch analysis from position: 102
Branch analysis from position: 103
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 103
filename:       /in/5EaN0
function name:  (null)
number of ops:  105
compiled vars:  !0 = $mysql_result, !1 = $query, !2 = $a_row, !3 = $content, !4 = $occurences, !5 = $results
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_DIM_W                                      $6      !0, 0
          1        ASSIGN_DIM                                               $6, 'id'
          2        OP_DATA                                                  '1'
    4     3        FETCH_DIM_W                                      $8      !0, 1
          4        ASSIGN_DIM                                               $8, 'id'
          5        OP_DATA                                                  '2'
    5     6        FETCH_DIM_W                                      $10     !0, 2
          7        ASSIGN_DIM                                               $10, 'id'
          8        OP_DATA                                                  '3'
    7     9        FETCH_DIM_W                                      $12     !0, 0
         10        ASSIGN_DIM                                               $12, 'address'
         11        OP_DATA                                                  'www.example.com%2Fpage1'
    8    12        FETCH_DIM_W                                      $14     !0, 1
         13        ASSIGN_DIM                                               $14, 'address'
         14        OP_DATA                                                  'www.example.com%2Fpage2'
    9    15        FETCH_DIM_W                                      $16     !0, 2
         16        ASSIGN_DIM                                               $16, 'address'
         17        OP_DATA                                                  'www.example.com%2Fpage3'
   11    18        FETCH_DIM_W                                      $18     !0, 0
         19        ASSIGN_DIM                                               $18, 'title'
         20        OP_DATA                                                  'Page+1'
   12    21        FETCH_DIM_W                                      $20     !0, 1
         22        ASSIGN_DIM                                               $20, 'title'
         23        OP_DATA                                                  'Page+2'
   13    24        FETCH_DIM_W                                      $22     !0, 2
         25        ASSIGN_DIM                                               $22, 'title'
         26        OP_DATA                                                  'Page+3'
   15    27        FETCH_DIM_W                                      $24     !0, 0
         28        ASSIGN_DIM                                               $24, 'content'
         29        OP_DATA                                                  'The+quick+dog+jumps+over+the+lazy+dog.'
   16    30        FETCH_DIM_W                                      $26     !0, 1
         31        ASSIGN_DIM                                               $26, 'content'
         32        OP_DATA                                                  'The+best+thing+about+morning+is+breakfast.'
   17    33        FETCH_DIM_W                                      $28     !0, 2
         34        ASSIGN_DIM                                               $28, 'content'
         35        OP_DATA                                                  'Hotdogs+are+great+ballpark+food.'
   19    36        FETCH_DIM_W                                      $30     !0, 0
         37        ASSIGN_DIM                                               $30, 'image'
         38        OP_DATA                                                  'image1.jpg'
   20    39        FETCH_DIM_W                                      $32     !0, 1
         40        ASSIGN_DIM                                               $32, 'image'
         41        OP_DATA                                                  'image2.jpg'
   21    42        FETCH_DIM_W                                      $34     !0, 2
         43        ASSIGN_DIM                                               $34, 'image'
         44        OP_DATA                                                  'image3.jpg'
   24    45        ASSIGN                                                   !1, 'dog'
   26    46      > FE_RESET_R                                       $37     !0, ->103
         47    > > FE_FETCH_R                                               $37, !2, ->103
   28    48    >   INIT_FCALL                                               'str_replace'
         49        SEND_VAR                                                 !1
         50        CONCAT                                           ~38     'my_un1qu3_r3pl4c3m3nt_', !1
         51        SEND_VAL                                                 ~38
         52        FETCH_DIM_R                                      ~39     !2, 'content'
         53        SEND_VAL                                                 ~39
         54        DO_ICALL                                         $40     
         55        ASSIGN                                                   !3, $40
   30    56        INIT_FCALL                                               'explode'
         57        SEND_VAL                                                 'my_un1qu3_r3pl4c3m3nt_'
         58        SEND_VAR                                                 !3
         59        DO_ICALL                                         $42     
         60        ASSIGN                                                   !4, $42
   32    61        COUNT                                            ~44     !4
         62        IS_SMALLER                                               1, ~44
         63      > JMPZ                                                     ~45, ->102
   34    64    > > FE_RESET_R                                       $46     !4, ->101
         65    > > FE_FETCH_R                                               $46, !5, ->101
   36    66    >   FETCH_DIM_R                                      ~47     !5, 'content'
         67        ASSIGN                                                   !3, ~47
   39    68        FETCH_DIM_R                                      ~49     !5, 'address'
         69        CONCAT                                           ~50     '%3Cli+class%3D%22media%22%3E%0A++++++++++++%3Ca+class%3D%22pull-left%22+href%3D%22', ~49
         70        CONCAT                                           ~51     ~50, '%22%3E%0A++++++++++++%3Cimg+class%3D%22media-object+thumbnail%22+src%3D%22'
   40    71        FETCH_DIM_R                                      ~52     !5, 'image'
         72        CONCAT                                           ~53     ~51, ~52
         73        CONCAT                                           ~54     ~53, '%22+style%3D%22height%3A100px+%21important%22%3E%0A++++++++++++%3C%2Fa%3E%0A++++++++++++%3Cdiv+class%3D%22media-body%22%3E%0A++++++++++++++%3Ch4+class%3D%22media-heading%22%3E%3Ca+href%3D%22'
   43    74        FETCH_DIM_R                                      ~55     !5, 'address'
         75        CONCAT                                           ~56     ~54, ~55
         76        CONCAT                                           ~57     ~56, '%22%3E'
         77        FETCH_DIM_R                                      ~58     !5, 'title'
         78        CONCAT                                           ~59     ~57, ~58
         79        CONCAT                                           ~60     ~59, '%3C%2Fa%3E%3C%2Fh4%3E%0A++++++++++++++%3Cp%3E...'
   44    80        INIT_FCALL                                               'str_replace'
         81        SEND_VAR                                                 !1
         82        CONCAT                                           ~61     '%3Cstrong%3E', !1
         83        CONCAT                                           ~62     ~61, '%3C%2Fstrong%3E'
         84        SEND_VAL                                                 ~62
         85        INIT_FCALL                                               'substr'
         86        SEND_VAR                                                 !3
         87        INIT_FCALL                                               'strpos'
         88        SEND_VAR                                                 !3
         89        SEND_VAR                                                 !1
         90        DO_ICALL                                         $63     
         91        SUB                                              ~64     $63, 25
         92        SEND_VAL                                                 ~64
         93        SEND_VAL                                                 160
         94        DO_ICALL                                         $65     
         95        SEND_VAR                                                 $65
         96        DO_ICALL                                         $66     
         97        CONCAT                                           ~67     ~60, $66
         98        CONCAT                                           ~68     ~67, '...%3C%2Fp%3E%0A++++++++++++%3C%2Fdiv%3E%0A+++++++++++%3C%2Fli%3E'
         99        ECHO                                                     ~68
   34   100      > JMP                                                      ->65
        101    >   FE_FREE                                                  $46
   26   102    > > JMP                                                      ->47
        103    >   FE_FREE                                                  $37
   49   104      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.66 ms | 1404 KiB | 21 Q