3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = "30.10.2012"; $input = "2012-10-30"; $reverse = true; $inputSplitChar = $reverse === false ? '.' : '-'; $OutputSplitChar = $reverse === false ? '-' : '.'; $resultArray = array_map('strrev', explode($inputSplitChar, strrev($input))); $result = implode($OutputSplitChar, $resultArray); echo $result;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
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: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
Branch analysis from position: 13
filename:       /in/TNNu9
function name:  (null)
number of ops:  34
compiled vars:  !0 = $input, !1 = $reverse, !2 = $inputSplitChar, !3 = $OutputSplitChar, !4 = $resultArray, !5 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '30.10.2012'
    3     1        ASSIGN                                                   !0, '2012-10-30'
    4     2        ASSIGN                                                   !1, <true>
    6     3        TYPE_CHECK                                    4          !1
          4      > JMPZ                                                     ~9, ->7
          5    >   QM_ASSIGN                                        ~10     '.'
          6      > JMP                                                      ->8
          7    >   QM_ASSIGN                                        ~10     '-'
          8    >   ASSIGN                                                   !2, ~10
    7     9        TYPE_CHECK                                    4          !1
         10      > JMPZ                                                     ~12, ->13
         11    >   QM_ASSIGN                                        ~13     '-'
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~13     '.'
         14    >   ASSIGN                                                   !3, ~13
    9    15        INIT_FCALL                                               'array_map'
         16        SEND_VAL                                                 'strrev'
         17        INIT_FCALL                                               'explode'
         18        SEND_VAR                                                 !2
         19        INIT_FCALL                                               'strrev'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                         $15     
         22        SEND_VAR                                                 $15
         23        DO_ICALL                                         $16     
         24        SEND_VAR                                                 $16
         25        DO_ICALL                                         $17     
         26        ASSIGN                                                   !4, $17
   10    27        INIT_FCALL                                               'implode'
         28        SEND_VAR                                                 !3
         29        SEND_VAR                                                 !4
         30        DO_ICALL                                         $19     
         31        ASSIGN                                                   !5, $19
   11    32        ECHO                                                     !5
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.2 ms | 1396 KiB | 21 Q