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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.43 ms | 1408 KiB | 27 Q