3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Attempt to reproduce "element" issue $url = urldecode( "eng%C3%A5%C2%BF%C2/Products" ); $elements = explode( '/', $url ); #$elements = array( "eng%C3%A5%C2%BF%C2", "Products" );// url, exploded by "/" $saList = array( "eng", "fre" ); $URIMatchElement = 1;// URIMatchElement setting $elements = array_slice( $elements, 0, $URIMatchElement ); $name = implode( '_', $elements ); echo $name . "\n"; $name = preg_replace( array( '/[^a-zA-Z0-9]+/', '/_+/', '/^_/', '/_$/' ), array( '_', '_', '', '' ), $name ); echo $name . "\n"; echo (in_array( $name, $saList ) ? "is valid sa" : "is not valid sa");// if issue is true, then this should be true
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KI92q
function name:  (null)
number of ops:  42
compiled vars:  !0 = $url, !1 = $elements, !2 = $saList, !3 = $URIMatchElement, !4 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'urldecode'
          1        SEND_VAL                                                 'eng%25C3%25A5%25C2%25BF%25C2%2FProducts'
          2        DO_ICALL                                         $5      
          3        ASSIGN                                                   !0, $5
    6     4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '%2F'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !1, $7
    9     9        ASSIGN                                                   !2, <array>
   10    10        ASSIGN                                                   !3, 1
   12    11        INIT_FCALL                                               'array_slice'
         12        SEND_VAR                                                 !1
         13        SEND_VAL                                                 0
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $11     
         16        ASSIGN                                                   !1, $11
   13    17        INIT_FCALL                                               'implode'
         18        SEND_VAL                                                 '_'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $13     
         21        ASSIGN                                                   !4, $13
   14    22        CONCAT                                           ~15     !4, '%0A'
         23        ECHO                                                     ~15
   15    24        INIT_FCALL                                               'preg_replace'
         25        SEND_VAL                                                 <array>
   16    26        SEND_VAL                                                 <array>
   17    27        SEND_VAR                                                 !4
         28        DO_ICALL                                         $16     
   15    29        ASSIGN                                                   !4, $16
   19    30        CONCAT                                           ~18     !4, '%0A'
         31        ECHO                                                     ~18
   20    32        INIT_FCALL                                               'in_array'
         33        SEND_VAR                                                 !4
         34        SEND_VAR                                                 !2
         35        DO_ICALL                                         $19     
         36      > JMPZ                                                     $19, ->39
         37    >   QM_ASSIGN                                        ~20     'is+valid+sa'
         38      > JMP                                                      ->40
         39    >   QM_ASSIGN                                        ~20     'is+not+valid+sa'
         40    >   ECHO                                                     ~20
         41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.77 ms | 1400 KiB | 25 Q