3v4l.org

run code in 300+ PHP versions simultaneously
<?php $conf['search_description'] = 160; $keywords = array('maison', 'vente', 'mornagia', 'manouba', '2013'); $description = 'Agence immobilière Dossenheim met en vente duplex a Jdaida d’une superficie 100m² composée d’un salon ,salle à manger, cuisine, 3 chambres à coucher, salle de bain et une salle d’eau ,d’un prix négociable 70MDT avec titre foncier indépendant Pour tout contact'; $plussize = 20; $snippet = ''; $to=0; $entre=0; //$description = utf8_decode($description); if(strlen($description) > $conf['search_description']) { $entre=0; for ($c = 0; $c < count($keywords); $c++) { $current_keyword = $keywords[$c]; $keyword_pos = strpos(strtolower($description), $current_keyword); if($keyword_pos === false) $ddddd=1; //anything else { $entre+=1; $from = max(intval($keyword_pos - $plussize),0,$to); $to = min(intval($keyword_pos + strlen($current_keyword) + $plussize),strlen($description)-1); if ($from>0) $part = '...'; else $part = ''; $part .= mb_substr($description, $from, $to); echo 'part' . $c . '=(' . $part . ') \n '; if(preg_match('/\s/', $part, $m, PREG_OFFSET_CAPTURE)) { $p1 = $m[0][1]+1; } else { $p1 = 0; } if(preg_match('/\s+(?=\S*+$)/', $part, $m, PREG_OFFSET_CAPTURE)) { $p2 = $m[0][1]-5; } else { $p2 = 0; } //$p1 = (strpos($part,' ')=== false)?0:mb_strpos($part,' ')+1; //$p2 = (strrpos($part,' ')=== false)?0:mb_strrpos($part,' '); echo 'p1='.$p1; echo ' p2 =' . $p2; $snippet .= '[' . substr($part, $p1, $p2) . ']'; if ($to<strlen($description)-1) $snippet .= '...'; } } if(strlen($snippet)< $conf['search_description'] && !empty($p2) && $p2<$conf['search_description'] ) $snippet = $snippet . substr($description,$p2+10,strlen($description)-1); if(strlen($snippet)>0) $description = $snippet; } echo $description;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 138
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 109
Branch analysis from position: 109
2 jumps found. (Code = 44) Position 1 = 112, Position 2 = 15
Branch analysis from position: 112
2 jumps found. (Code = 46) Position 1 = 116, Position 2 = 119
Branch analysis from position: 116
2 jumps found. (Code = 46) Position 1 = 120, Position 2 = 123
Branch analysis from position: 120
2 jumps found. (Code = 43) Position 1 = 124, Position 2 = 134
Branch analysis from position: 124
2 jumps found. (Code = 43) Position 1 = 137, Position 2 = 138
Branch analysis from position: 137
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 138
Branch analysis from position: 134
Branch analysis from position: 123
Branch analysis from position: 119
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 108
Branch analysis from position: 108
2 jumps found. (Code = 44) Position 1 = 112, Position 2 = 15
Branch analysis from position: 112
Branch analysis from position: 15
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 53
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
2 jumps found. (Code = 43) Position 1 = 72, Position 2 = 77
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
2 jumps found. (Code = 43) Position 1 = 85, Position 2 = 90
Branch analysis from position: 85
1 jumps found. (Code = 42) Position 1 = 91
Branch analysis from position: 91
2 jumps found. (Code = 43) Position 1 = 107, Position 2 = 108
Branch analysis from position: 107
2 jumps found. (Code = 44) Position 1 = 112, Position 2 = 15
Branch analysis from position: 112
Branch analysis from position: 15
Branch analysis from position: 108
Branch analysis from position: 90
2 jumps found. (Code = 43) Position 1 = 107, Position 2 = 108
Branch analysis from position: 107
Branch analysis from position: 108
Branch analysis from position: 77
2 jumps found. (Code = 43) Position 1 = 85, Position 2 = 90
Branch analysis from position: 85
Branch analysis from position: 90
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 72, Position 2 = 77
Branch analysis from position: 72
Branch analysis from position: 77
Branch analysis from position: 138
filename:       /in/vlco3
function name:  (null)
number of ops:  140
compiled vars:  !0 = $conf, !1 = $keywords, !2 = $description, !3 = $plussize, !4 = $snippet, !5 = $to, !6 = $entre, !7 = $c, !8 = $current_keyword, !9 = $keyword_pos, !10 = $ddddd, !11 = $from, !12 = $part, !13 = $m, !14 = $p1, !15 = $p2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN_DIM                                               !0, 'search_description'
          1        OP_DATA                                                  160
    3     2        ASSIGN                                                   !1, <array>
    4     3        ASSIGN                                                   !2, 'Agence+immobili%C3%A8re+Dossenheim+met+en+vente+duplex+a+Jdaida+d%E2%80%99une+superficie+100m%C2%B2+compos%C3%A9e+d%E2%80%99un+salon+%2Csalle+%C3%A0+manger%2C+cuisine%2C+3+chambres+%C3%A0+coucher%2C+salle+de+bain+et+une+salle+d%E2%80%99eau+%2Cd%E2%80%99un+prix+n%C3%A9gociable+70MDT+avec+titre+foncier+ind%C3%A9pendant+Pour+tout+contact'
    6     4        ASSIGN                                                   !3, 20
    7     5        ASSIGN                                                   !4, ''
    8     6        ASSIGN                                                   !5, 0
    9     7        ASSIGN                                                   !6, 0
   11     8        STRLEN                                           ~23     !2
          9        FETCH_DIM_R                                      ~24     !0, 'search_description'
         10        IS_SMALLER                                               ~24, ~23
         11      > JMPZ                                                     ~25, ->138
   13    12    >   ASSIGN                                                   !6, 0
   14    13        ASSIGN                                                   !7, 0
         14      > JMP                                                      ->109
   16    15    >   FETCH_DIM_R                                      ~28     !1, !7
         16        ASSIGN                                                   !8, ~28
   17    17        INIT_FCALL                                               'strpos'
         18        INIT_FCALL                                               'strtolower'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $30     
         21        SEND_VAR                                                 $30
         22        SEND_VAR                                                 !8
         23        DO_ICALL                                         $31     
         24        ASSIGN                                                   !9, $31
   19    25        TYPE_CHECK                                    4          !9
         26      > JMPZ                                                     ~33, ->29
   20    27    >   ASSIGN                                                   !10, 1
         28      > JMP                                                      ->108
   23    29    >   ASSIGN_OP                                     1          !6, 1
   25    30        INIT_FCALL                                               'max'
         31        SUB                                              ~36     !9, !3
         32        CAST                                          4  ~37     ~36
         33        SEND_VAL                                                 ~37
         34        SEND_VAL                                                 0
         35        SEND_VAR                                                 !5
         36        DO_ICALL                                         $38     
         37        ASSIGN                                                   !11, $38
   26    38        INIT_FCALL                                               'min'
         39        STRLEN                                           ~40     !8
         40        ADD                                              ~41     !9, ~40
         41        ADD                                              ~42     ~41, !3
         42        CAST                                          4  ~43     ~42
         43        SEND_VAL                                                 ~43
         44        STRLEN                                           ~44     !2
         45        SUB                                              ~45     ~44, 1
         46        SEND_VAL                                                 ~45
         47        DO_ICALL                                         $46     
         48        ASSIGN                                                   !5, $46
   27    49        IS_SMALLER                                               0, !11
         50      > JMPZ                                                     ~48, ->53
   28    51    >   ASSIGN                                                   !12, '...'
         52      > JMP                                                      ->54
   30    53    >   ASSIGN                                                   !12, ''
   31    54    >   INIT_FCALL                                               'mb_substr'
         55        SEND_VAR                                                 !2
         56        SEND_VAR                                                 !11
         57        SEND_VAR                                                 !5
         58        DO_ICALL                                         $51     
         59        ASSIGN_OP                                     8          !12, $51
   33    60        CONCAT                                           ~53     'part', !7
         61        CONCAT                                           ~54     ~53, '%3D%28'
         62        CONCAT                                           ~55     ~54, !12
         63        CONCAT                                           ~56     ~55, '%29+%5Cn+'
         64        ECHO                                                     ~56
   35    65        INIT_FCALL                                               'preg_match'
         66        SEND_VAL                                                 '%2F%5Cs%2F'
         67        SEND_VAR                                                 !12
         68        SEND_REF                                                 !13
         69        SEND_VAL                                                 256
         70        DO_ICALL                                         $57     
         71      > JMPZ                                                     $57, ->77
   36    72    >   FETCH_DIM_R                                      ~58     !13, 0
         73        FETCH_DIM_R                                      ~59     ~58, 1
         74        ADD                                              ~60     ~59, 1
         75        ASSIGN                                                   !14, ~60
         76      > JMP                                                      ->78
   38    77    >   ASSIGN                                                   !14, 0
   40    78    >   INIT_FCALL                                               'preg_match'
         79        SEND_VAL                                                 '%2F%5Cs%2B%28%3F%3D%5CS%2A%2B%24%29%2F'
         80        SEND_VAR                                                 !12
         81        SEND_REF                                                 !13
         82        SEND_VAL                                                 256
         83        DO_ICALL                                         $63     
         84      > JMPZ                                                     $63, ->90
   41    85    >   FETCH_DIM_R                                      ~64     !13, 0
         86        FETCH_DIM_R                                      ~65     ~64, 1
         87        SUB                                              ~66     ~65, 5
         88        ASSIGN                                                   !15, ~66
         89      > JMP                                                      ->91
   43    90    >   ASSIGN                                                   !15, 0
   48    91    >   CONCAT                                           ~69     'p1%3D', !14
         92        ECHO                                                     ~69
   49    93        CONCAT                                           ~70     '++p2+%3D', !15
         94        ECHO                                                     ~70
   50    95        INIT_FCALL                                               'substr'
         96        SEND_VAR                                                 !12
         97        SEND_VAR                                                 !14
         98        SEND_VAR                                                 !15
         99        DO_ICALL                                         $71     
        100        CONCAT                                           ~72     '%5B', $71
        101        CONCAT                                           ~73     ~72, '%5D'
        102        ASSIGN_OP                                     8          !4, ~73
   51   103        STRLEN                                           ~75     !2
        104        SUB                                              ~76     ~75, 1
        105        IS_SMALLER                                               !5, ~76
        106      > JMPZ                                                     ~77, ->108
   52   107    >   ASSIGN_OP                                     8          !4, '...'
   14   108    >   PRE_INC                                                  !7
        109    >   COUNT                                            ~80     !1
        110        IS_SMALLER                                               !7, ~80
        111      > JMPNZ                                                    ~81, ->15
   57   112    >   STRLEN                                           ~82     !4
        113        FETCH_DIM_R                                      ~83     !0, 'search_description'
        114        IS_SMALLER                                       ~84     ~82, ~83
        115      > JMPZ_EX                                          ~84     ~84, ->119
        116    >   ISSET_ISEMPTY_CV                                 ~85     !15
        117        BOOL_NOT                                         ~86     ~85
        118        BOOL                                             ~84     ~86
        119    > > JMPZ_EX                                          ~84     ~84, ->123
        120    >   FETCH_DIM_R                                      ~87     !0, 'search_description'
        121        IS_SMALLER                                       ~88     !15, ~87
        122        BOOL                                             ~84     ~88
        123    > > JMPZ                                                     ~84, ->134
   58   124    >   INIT_FCALL                                               'substr'
        125        SEND_VAR                                                 !2
        126        ADD                                              ~89     !15, 10
        127        SEND_VAL                                                 ~89
        128        STRLEN                                           ~90     !2
        129        SUB                                              ~91     ~90, 1
        130        SEND_VAL                                                 ~91
        131        DO_ICALL                                         $92     
        132        CONCAT                                           ~93     !4, $92
        133        ASSIGN                                                   !4, ~93
   59   134    >   STRLEN                                           ~95     !4
        135        IS_SMALLER                                               0, ~95
        136      > JMPZ                                                     ~96, ->138
   60   137    >   ASSIGN                                                   !2, !4
   63   138    >   ECHO                                                     !2
        139      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.55 ms | 1408 KiB | 27 Q