3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Convert all dashes/underscores into separator $title = "Convert all dashes/underscores into separator"; $separator = "-"; $flip = $separa;tor == '-' ? '_' : '-'; $title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title); // Remove all characters that are not the separator, letters, numbers, or whitespace. $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($title)); // Replace all separator characters and whitespace by a single separator $title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title); echo trim($title, $separator);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uattP
function name:  (null)
number of ops:  52
compiled vars:  !0 = $title, !1 = $separator, !2 = $flip, !3 = $separa
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 'Convert+all+dashes%2Funderscores+into+separator'
    5     1        ASSIGN                                                   !1, '-'
    6     2        ASSIGN                                                   !2, !3
          3        FETCH_CONSTANT                                   ~7      'tor'
          4        IS_EQUAL                                                 ~7, '-'
          5      > JMPZ                                                     ~8, ->8
          6    >   QM_ASSIGN                                        ~9      '_'
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~9      '-'
          9    >   FREE                                                     ~9
    8    10        INIT_FCALL                                               'preg_replace'
         11        INIT_FCALL                                               'preg_quote'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $10     
         14        CONCAT                                           ~11     '%21%5B', $10
         15        CONCAT                                           ~12     ~11, '%5D%2B%21u'
         16        SEND_VAL                                                 ~12
         17        SEND_VAR                                                 !1
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $13     
         20        ASSIGN                                                   !0, $13
   11    21        INIT_FCALL                                               'preg_replace'
         22        INIT_FCALL                                               'preg_quote'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                         $15     
         25        CONCAT                                           ~16     '%21%5B%5E', $15
         26        CONCAT                                           ~17     ~16, '%5CpL%5CpN%5Cs%5D%2B%21u'
         27        SEND_VAL                                                 ~17
         28        SEND_VAL                                                 ''
         29        INIT_FCALL                                               'mb_strtolower'
         30        SEND_VAR                                                 !0
         31        DO_ICALL                                         $18     
         32        SEND_VAR                                                 $18
         33        DO_ICALL                                         $19     
         34        ASSIGN                                                   !0, $19
   14    35        INIT_FCALL                                               'preg_replace'
         36        INIT_FCALL                                               'preg_quote'
         37        SEND_VAR                                                 !1
         38        DO_ICALL                                         $21     
         39        CONCAT                                           ~22     '%21%5B', $21
         40        CONCAT                                           ~23     ~22, '%5Cs%5D%2B%21u'
         41        SEND_VAL                                                 ~23
         42        SEND_VAR                                                 !1
         43        SEND_VAR                                                 !0
         44        DO_ICALL                                         $24     
         45        ASSIGN                                                   !0, $24
   16    46        INIT_FCALL                                               'trim'
         47        SEND_VAR                                                 !0
         48        SEND_VAR                                                 !1
         49        DO_ICALL                                         $26     
         50        ECHO                                                     $26
         51      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.77 ms | 1405 KiB | 21 Q