3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ 'This, is - - the URL!', 'Holmes & Yoyo', 'L’Œil de démon', 'How to win 1000€?', '€, $ & other currency symbols', 'Und die Katze fraß alle mäuse.', 'Яростта на живота в София', 'പോണ്ടിച്ചേരിയിൽ താമസിക്കുന്നതിന്റെ ക്രോധം', ]; $rules = <<<'RULES' # Transliteration :: Any-Latin ; :: Latin-Ascii ; # examples of custom replacements '&' > ' and '; [^0-9][01]? { € > ' euro'; € > ' euros'; [^0-9][01]? { '$' > ' dollar'; '$' > ' dollars'; :: Null; # slugify [^[:alnum:]&[:ascii:]]+ > '-'; :: Lower ; # trim [$] { '-' > &Remove(); '-' } [$] > &Remove(); RULES; $tsl = Transliterator::createFromRules($rules, Transliterator::FORWARD); $results = array_map(fn($s) => $tsl->transliterate($s), $strings); print_r($results);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/29B3R
function name:  (null)
number of ops:  19
compiled vars:  !0 = $strings, !1 = $rules, !2 = $tsl, !3 = $results
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        ASSIGN                                                   !1, '%23+Transliteration%0A%3A%3A+Any-Latin+%3B+%3A%3A+Latin-Ascii+%3B%0A%0A%23+examples+of+custom+replacements%0A%27%26%27+%3E+%27+and+%27%3B%0A%5B%5E0-9%5D%5B01%5D%3F+%7B+%E2%82%AC+%3E+%27+euro%27%3B+%E2%82%AC+%3E+%27+euros%27%3B%0A%5B%5E0-9%5D%5B01%5D%3F+%7B+%27%24%27+%3E+%27+dollar%27%3B+%27%24%27+%3E+%27+dollars%27%3B%0A%3A%3A+Null%3B%0A%0A%23+slugify%0A%5B%5E%5B%3Aalnum%3A%5D%26%5B%3Aascii%3A%5D%5D%2B+%3E+%27-%27%3B%0A%3A%3A+Lower+%3B%0A%0A%23+trim%0A%5B%24%5D+%7B+%27-%27+%3E+%26Remove%28%29%3B%0A%27-%27+%7D+%5B%24%5D+%3E+%26Remove%28%29%3B'
   33     2        INIT_STATIC_METHOD_CALL                                  'Transliterator', 'createFromRules'
          3        SEND_VAR_EX                                              !1
          4        FETCH_CLASS_CONSTANT                             ~6      'Transliterator', 'FORWARD'
          5        SEND_VAL_EX                                              ~6
          6        DO_FCALL                                      0  $7      
          7        ASSIGN                                                   !2, $7
   34     8        INIT_FCALL                                               'array_map'
          9        DECLARE_LAMBDA_FUNCTION                          ~9      [0]
         10        BIND_LEXICAL                                             ~9, !2
         11        SEND_VAL                                                 ~9
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !3, $10
   35    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                                 
         18      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/29B3R
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $s, !1 = $tsl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        INIT_METHOD_CALL                                         !1, 'transliterate'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5      > RETURN                                                   $2
          6*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.15 ms | 1438 KiB | 15 Q