3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'pippo ASC, `table`.`pippo` DESC, campo.discendente DESC, `tabella`.`asc` ASC'; $string = preg_replace_callback('#\b(ASC|DESC)\b#i', function($match) { switch(strtoupper($match[1])) { case 'ASC': return 'DESC'; case 'DESC': return 'ASC'; } }, $string); echo $string;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Io6kM
function name:  (null)
number of ops:  10
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'pippo+ASC%2C+%60table%60.%60pippo%60+DESC%2C+campo.discendente+DESC%2C+%60tabella%60.%60asc%60+ASC'
    4     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%23%5Cb%28ASC%7CDESC%29%5Cb%23i'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FIo6kM%3A4%240'
    9     4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
    4     7        ASSIGN                                                   !0, $3
   12     8        ECHO                                                     !0
          9      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FIo6kM%3A4%240:
Finding entry points
Branch analysis from position: 0
4 jumps found. (Code = 188) Position 1 = 11, Position 2 = 13, Position 3 = 15, Position 4 = 6
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 13
Branch analysis from position: 11
filename:       /in/Io6kM
function name:  {closure}
number of ops:  17
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'strtoupper'
          2        FETCH_DIM_R                                      ~1      !0, 1
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5      > SWITCH_STRING                                            $2, [ 'ASC':->11, 'DESC':->13, ], ->15
    6     6    >   CASE                                                     $2, 'ASC'
          7      > JMPNZ                                                    ~3, ->11
    7     8    >   CASE                                                     $2, 'DESC'
          9      > JMPNZ                                                    ~3, ->13
         10    > > JMP                                                      ->15
    6    11    >   FREE                                                     $2
         12      > RETURN                                                   'DESC'
    7    13    >   FREE                                                     $2
         14      > RETURN                                                   'ASC'
         15    >   FREE                                                     $2
    9    16      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FIo6kM%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.22 ms | 1396 KiB | 17 Q