3v4l.org

run code in 300+ PHP versions simultaneously
<?php function normaliza ($string){ $a = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿ'; $b = 'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyyby'; $string = utf8_decode($string); $string = strtr($string, utf8_decode($a), $b); $string = strtolower($string); return utf8_encode($string); } function parseStopWords($text){ $text = str_replace('¡¿?!', '', $text); $text = preg_replace('/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ\', ]/i','',$text); $stopwords = array('ante','bajo','cabe','con','contra','de','desde','en','entre','hacia','hasta','para','por','sin','sobre','tras','el','lo','la','los','las','un','unos','una','al','del','que','es','se','y','fue'); foreach($stopwords as $w){ $text = preg_replace('/\b'.$w.'\b/i','',$text); } $text = preg_replace('/\s{2,}/i',' ',$text); $text = str_replace(" a ", "", $text); return $text; } echo parseStopWords(normaliza('¿Qué ha sido de nuestra niñez?'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gmmsH
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_FCALL                                               'parsestopwords'
          1        INIT_FCALL                                               'normaliza'
          2        SEND_VAL                                                 '%C2%BFQu%C3%A9+ha+sido+de+nuestra+ni%C3%B1ez%3F'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_FCALL                                      0  $1      
          6        ECHO                                                     $1
          7      > RETURN                                                   1

Function normaliza:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gmmsH
function name:  normaliza
number of ops:  25
compiled vars:  !0 = $string, !1 = $a, !2 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, '%C3%80%C3%81%C3%82%C3%83%C3%84%C3%85%C3%86%C3%87%C3%88%C3%89%C3%8A%C3%8B%C3%8C%C3%8D%C3%8E%C3%8F%C3%90%C3%91%C3%92%C3%93%C3%94%C3%95%C3%96%C3%98%C3%99%C3%9A%C3%9B%C3%9C%C3%9D%C3%9E%C3%9F%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%A8%C3%A9%C3%AA%C3%AB%C3%AC%C3%AD%C3%AE%C3%AF%C3%B0%C3%B1%C3%B2%C3%B3%C3%B4%C3%B5%C3%B6%C3%B8%C3%B9%C3%BA%C3%BB%C3%BD%C3%BD%C3%BE%C3%BF'
    4     2        ASSIGN                                                   !2, 'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyyby'
    5     3        INIT_FCALL                                               'utf8_decode'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !0, $5
    6     7        INIT_FCALL                                               'strtr'
          8        SEND_VAR                                                 !0
          9        INIT_FCALL                                               'utf8_decode'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $7      
         12        SEND_VAR                                                 $7
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $8      
         15        ASSIGN                                                   !0, $8
    7    16        INIT_FCALL                                               'strtolower'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $10     
         19        ASSIGN                                                   !0, $10
    8    20        INIT_FCALL                                               'utf8_encode'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $12     
         23      > RETURN                                                   $12
    9    24*     > RETURN                                                   null

End of function normaliza

Function parsestopwords:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 25
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 25
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/gmmsH
function name:  parseStopWords
number of ops:  40
compiled vars:  !0 = $text, !1 = $stopwords, !2 = $w
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 '%C2%A1%C2%BF%3F%21'
          3        SEND_VAL                                                 ''
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !0, $3
   13     7        INIT_FCALL                                               'preg_replace'
          8        SEND_VAL                                                 '%2F%5B%5Ea-zA-Z0-9%C3%A1%C3%A9%C3%AD%C3%B3%C3%BA%C3%B1%C3%81%C3%89%C3%8D%C3%93%C3%9A%C3%91%27%2C+%5D%2Fi'
          9        SEND_VAL                                                 ''
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $5      
         12        ASSIGN                                                   !0, $5
   14    13        ASSIGN                                                   !1, <array>
   16    14      > FE_RESET_R                                       $8      !1, ->25
         15    > > FE_FETCH_R                                               $8, !2, ->25
   17    16    >   INIT_FCALL                                               'preg_replace'
         17        CONCAT                                           ~9      '%2F%5Cb', !2
         18        CONCAT                                           ~10     ~9, '%5Cb%2Fi'
         19        SEND_VAL                                                 ~10
         20        SEND_VAL                                                 ''
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $11     
         23        ASSIGN                                                   !0, $11
   16    24      > JMP                                                      ->15
         25    >   FE_FREE                                                  $8
   19    26        INIT_FCALL                                               'preg_replace'
         27        SEND_VAL                                                 '%2F%5Cs%7B2%2C%7D%2Fi'
         28        SEND_VAL                                                 '+'
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                         $13     
         31        ASSIGN                                                   !0, $13
   20    32        INIT_FCALL                                               'str_replace'
         33        SEND_VAL                                                 '+a+'
         34        SEND_VAL                                                 ''
         35        SEND_VAR                                                 !0
         36        DO_ICALL                                         $15     
         37        ASSIGN                                                   !0, $15
   21    38      > RETURN                                                   !0
   22    39*     > RETURN                                                   null

End of function parsestopwords

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.03 ms | 1407 KiB | 27 Q