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 = mb_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; 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]; } else { $p2 = 0; } //$p1 = (strpos($part,' ')=== false)?0:mb_strpos($part,' ')+1; //$p2 = (strrpos($part,' ')=== false)?0:mb_strrpos($part,' '); $snippet .= '[' . substr($part, $p1, $p2) . ']'; if ($to<strlen($description)-1) $snippet .= '...'; } } if(strlen($snippet)< $conf['search_description'] && $to>0 && $to<$conf['search_description'] ) $snippet = $snippet . mb_substr($description,$to,strlen($description)-1, 'UTF-8'); 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 = 131
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 103
Branch analysis from position: 103
2 jumps found. (Code = 44) Position 1 = 106, Position 2 = 15
Branch analysis from position: 106
2 jumps found. (Code = 46) Position 1 = 110, Position 2 = 112
Branch analysis from position: 110
2 jumps found. (Code = 46) Position 1 = 113, Position 2 = 116
Branch analysis from position: 113
2 jumps found. (Code = 43) Position 1 = 117, Position 2 = 127
Branch analysis from position: 117
2 jumps found. (Code = 43) Position 1 = 130, Position 2 = 131
Branch analysis from position: 130
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 131
Branch analysis from position: 127
Branch analysis from position: 116
Branch analysis from position: 112
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 = 102
Branch analysis from position: 102
2 jumps found. (Code = 44) Position 1 = 106, Position 2 = 15
Branch analysis from position: 106
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 = 71, Position 2 = 76
Branch analysis from position: 71
1 jumps found. (Code = 42) Position 1 = 77
Branch analysis from position: 77
2 jumps found. (Code = 43) Position 1 = 84, Position 2 = 88
Branch analysis from position: 84
1 jumps found. (Code = 42) Position 1 = 89
Branch analysis from position: 89
2 jumps found. (Code = 43) Position 1 = 101, Position 2 = 102
Branch analysis from position: 101
2 jumps found. (Code = 44) Position 1 = 106, Position 2 = 15
Branch analysis from position: 106
Branch analysis from position: 15
Branch analysis from position: 102
Branch analysis from position: 88
2 jumps found. (Code = 43) Position 1 = 101, Position 2 = 102
Branch analysis from position: 101
Branch analysis from position: 102
Branch analysis from position: 76
2 jumps found. (Code = 43) Position 1 = 84, Position 2 = 88
Branch analysis from position: 84
Branch analysis from position: 88
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 71, Position 2 = 76
Branch analysis from position: 71
Branch analysis from position: 76
Branch analysis from position: 131
filename:       /in/b2bds
function name:  (null)
number of ops:  133
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, ->131
   13    12    >   ASSIGN                                                   !6, 0
   14    13        ASSIGN                                                   !7, 0
         14      > JMP                                                      ->103
   16    15    >   FETCH_DIM_R                                      ~28     !1, !7
         16        ASSIGN                                                   !8, ~28
   17    17        INIT_FCALL                                               'mb_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                                                      ->102
   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
   32    60        CONCAT                                           ~53     'part', !7
         61        CONCAT                                           ~54     ~53, '%3D'
         62        CONCAT                                           ~55     ~54, !12
         63        ECHO                                                     ~55
   34    64        INIT_FCALL                                               'preg_match'
         65        SEND_VAL                                                 '%2F%5Cs%2F'
         66        SEND_VAR                                                 !12
         67        SEND_REF                                                 !13
         68        SEND_VAL                                                 256
         69        DO_ICALL                                         $56     
         70      > JMPZ                                                     $56, ->76
   35    71    >   FETCH_DIM_R                                      ~57     !13, 0
         72        FETCH_DIM_R                                      ~58     ~57, 1
         73        ADD                                              ~59     ~58, 1
         74        ASSIGN                                                   !14, ~59
         75      > JMP                                                      ->77
   37    76    >   ASSIGN                                                   !14, 0
   39    77    >   INIT_FCALL                                               'preg_match'
         78        SEND_VAL                                                 '%2F%5Cs%2B%28%3F%3D%5CS%2A%2B%24%29%2F'
         79        SEND_VAR                                                 !12
         80        SEND_REF                                                 !13
         81        SEND_VAL                                                 256
         82        DO_ICALL                                         $62     
         83      > JMPZ                                                     $62, ->88
   40    84    >   FETCH_DIM_R                                      ~63     !13, 0
         85        FETCH_DIM_R                                      ~64     ~63, 1
         86        ASSIGN                                                   !15, ~64
         87      > JMP                                                      ->89
   42    88    >   ASSIGN                                                   !15, 0
   47    89    >   INIT_FCALL                                               'substr'
         90        SEND_VAR                                                 !12
         91        SEND_VAR                                                 !14
         92        SEND_VAR                                                 !15
         93        DO_ICALL                                         $67     
         94        CONCAT                                           ~68     '%5B', $67
         95        CONCAT                                           ~69     ~68, '%5D'
         96        ASSIGN_OP                                     8          !4, ~69
   48    97        STRLEN                                           ~71     !2
         98        SUB                                              ~72     ~71, 1
         99        IS_SMALLER                                               !5, ~72
        100      > JMPZ                                                     ~73, ->102
   49   101    >   ASSIGN_OP                                     8          !4, '...'
   14   102    >   PRE_INC                                                  !7
        103    >   COUNT                                            ~76     !1
        104        IS_SMALLER                                               !7, ~76
        105      > JMPNZ                                                    ~77, ->15
   54   106    >   STRLEN                                           ~78     !4
        107        FETCH_DIM_R                                      ~79     !0, 'search_description'
        108        IS_SMALLER                                       ~80     ~78, ~79
        109      > JMPZ_EX                                          ~80     ~80, ->112
        110    >   IS_SMALLER                                       ~81     0, !5
        111        BOOL                                             ~80     ~81
        112    > > JMPZ_EX                                          ~80     ~80, ->116
        113    >   FETCH_DIM_R                                      ~82     !0, 'search_description'
        114        IS_SMALLER                                       ~83     !5, ~82
        115        BOOL                                             ~80     ~83
        116    > > JMPZ                                                     ~80, ->127
   55   117    >   INIT_FCALL                                               'mb_substr'
        118        SEND_VAR                                                 !2
        119        SEND_VAR                                                 !5
        120        STRLEN                                           ~84     !2
        121        SUB                                              ~85     ~84, 1
        122        SEND_VAL                                                 ~85
        123        SEND_VAL                                                 'UTF-8'
        124        DO_ICALL                                         $86     
        125        CONCAT                                           ~87     !4, $86
        126        ASSIGN                                                   !4, ~87
   56   127    >   STRLEN                                           ~89     !4
        128        IS_SMALLER                                               0, ~89
        129      > JMPZ                                                     ~90, ->131
   57   130    >   ASSIGN                                                   !2, !4
   60   131    >   ECHO                                                     !2
        132      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.06 ms | 1408 KiB | 27 Q