3v4l.org

run code in 500+ PHP versions simultaneously
<?php $icelandic = array( 'jan' => 'January', 'feb' => 'February', 'mar' => 'March', 'apr' => 'April', 'maí' => 'May', 'jún' => 'June', 'júl' => 'July', 'ágú' => 'August', 'okt' => 'October', 'sep' => 'September', 'nóv' => 'November', 'des' => 'December', ); $tests = array( '1. júní 2018 04:53', '2. Ágú 2018 04:53', '3. Maí 2018 04:53', '4. nóvember 2018 04:53', '5. Des 2018 04:53' ); foreach ($tests as $test) { echo "\n$test -> "; echo preg_replace_callback('~(' . implode('|', array_keys($icelandic)) . ')\pL*~iu', function($m)use($icelandic) { return $icelandic[mb_strtolower($m[1], 'UTF-8')]; }, $test); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 23
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 23
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/QZntM
function name:  (null)
number of ops:  25
compiled vars:  !0 = $icelandic, !1 = $tests, !2 = $test
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
   17     1        ASSIGN                                                       !1, <array>
   25     2      > FE_RESET_R                                           $5      !1, ->23
          3    > > FE_FETCH_R                                                   $5, !2, ->23
   26     4    >   ROPE_INIT                                         3  ~7      '%0A'
          5        ROPE_ADD                                          1  ~7      ~7, !2
          6        ROPE_END                                          2  ~6      ~7, '+-%3E+'
          7        ECHO                                                         ~6
   27     8        INIT_FCALL                                                   'preg_replace_callback'
          9        INIT_FCALL                                                   'array_keys'
         10        SEND_VAR                                                     !0
         11        DO_ICALL                                             $9      
         12        FRAMELESS_ICALL_2                implode             ~10     '%7C', $9
         13        CONCAT                                               ~11     '%7E%28', ~10
         14        CONCAT                                               ~12     ~11, '%29%5CpL%2A%7Eiu'
         15        SEND_VAL                                                     ~12
         16        DECLARE_LAMBDA_FUNCTION                              ~13     [0]
         17        BIND_LEXICAL                                                 ~13, !0
   29    18        SEND_VAL                                                     ~13
         19        SEND_VAR                                                     !2
   27    20        DO_ICALL                                             $14     
   29    21        ECHO                                                         $14
   25    22      > JMP                                                          ->3
         23    >   FE_FREE                                                      $5
   30    24      > 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/QZntM
function name:  {closure:/in/QZntM:27}
number of ops:  10
compiled vars:  !0 = $m, !1 = $icelandic
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   27     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
   28     2        INIT_FCALL                                                   'mb_strtolower'
          3        FETCH_DIM_R                                          ~2      !0, 1
          4        SEND_VAL                                                     ~2
          5        SEND_VAL                                                     'UTF-8'
          6        DO_ICALL                                             $3      
          7        FETCH_DIM_R                                          ~4      !1, $3
          8      > RETURN                                                       ~4
   29     9*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.69 ms | 2250 KiB | 16 Q