3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = ' Namnet på bildtävlingen nº1@2020-`24...like&share'; $slug = \Transliterator::createFromRules(" :: Any-Latin; :: NFD; :: [:Mn:] Remove; :: NFKC; :: Latin-ASCII; :: Lower(); ^[^[:Ll:][:Nd:]]+ > ; [^[:Ll:][:Nd:]]+$ > ; [^[:Ll:][:Nd:]]+ > '-'; ")->transliterate($string); $slug = preg_replace(['/[^a-z0-9-]+/', '/^-+|(?<=-)-+|-+$/'], '', $slug); $slugPrev = \Transliterator::createFromRules(" :: Any-Latin; :: NFD; :: [:Nonspacing Mark:] Remove; :: NFC; :: [^-[:^Punctuation:]] Remove; :: Lower(); [:^L:] { [-] > ; [-] } [:^L:] > ; [-[:Separator:]]+ > '-'; ")->transliterate($string); echo "$slugPrev -> $slug";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vtJiH
function name:  (null)
number of ops:  26
compiled vars:  !0 = $string, !1 = $slug, !2 = $slugPrev
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '+Namnet+p%C3%A5+bildt%C3%A4vlingen+n%C2%BA1%402020-%6024...like%26share'
    5     1        INIT_STATIC_METHOD_CALL                                  'Transliterator', 'createFromRules'
          2        SEND_VAL_EX                                              '%0A%09%3A%3A+Any-Latin%3B%0A%09%3A%3A+NFD%3B%0A%09%3A%3A+%5B%3AMn%3A%5D+Remove%3B%0A%09%3A%3A+NFKC%3B%0A%09%3A%3A+Latin-ASCII%3B%0A%09%3A%3A+Lower%28%29%3B%0A%09%5E%5B%5E%5B%3ALl%3A%5D%5B%3ANd%3A%5D%5D%2B+%3E+%3B%0A%09%5B%5E%5B%3ALl%3A%5D%5B%3ANd%3A%5D%5D%2B%24+%3E+%3B%0A%09%5B%5E%5B%3ALl%3A%5D%5B%3ANd%3A%5D%5D%2B+%3E+%27-%27%3B%0A'
          3        DO_FCALL                                      0  $4      
   15     4        INIT_METHOD_CALL                                         $4, 'transliterate'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $5      
    5     7        ASSIGN                                                   !1, $5
   17     8        INIT_FCALL                                               'preg_replace'
          9        SEND_VAL                                                 <array>
         10        SEND_VAL                                                 ''
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $7      
         13        ASSIGN                                                   !1, $7
   19    14        INIT_STATIC_METHOD_CALL                                  'Transliterator', 'createFromRules'
         15        SEND_VAL_EX                                              '%0A++++%3A%3A+Any-Latin%3B%0A++++%3A%3A+NFD%3B%0A++++%3A%3A+%5B%3ANonspacing+Mark%3A%5D+Remove%3B%0A++++%3A%3A+NFC%3B%0A++++%3A%3A+%5B%5E-%5B%3A%5EPunctuation%3A%5D%5D+Remove%3B%0A++++%3A%3A+Lower%28%29%3B%0A++++%5B%3A%5EL%3A%5D+%7B+%5B-%5D+%3E+%3B%0A++++%5B-%5D+%7D+%5B%3A%5EL%3A%5D+%3E+%3B%0A++++%5B-%5B%3ASeparator%3A%5D%5D%2B+%3E+%27-%27%3B%0A'
         16        DO_FCALL                                      0  $9      
   29    17        INIT_METHOD_CALL                                         $9, 'transliterate'
         18        SEND_VAR_EX                                              !0
         19        DO_FCALL                                      0  $10     
   19    20        ASSIGN                                                   !2, $10
   31    21        ROPE_INIT                                     3  ~13     !2
         22        ROPE_ADD                                      1  ~13     ~13, '+-%3E+'
         23        ROPE_END                                      2  ~12     ~13, !1
         24        ECHO                                                     ~12
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.92 ms | 1070 KiB | 14 Q