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 ); echo count( $elements ) . "\n"; $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 = 40, Position 2 = 42
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gqON1
function name:  (null)
number of ops:  45
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        COUNT                                            ~13     !1
         18        CONCAT                                           ~14     ~13, '%0A'
         19        ECHO                                                     ~14
   14    20        INIT_FCALL                                               'implode'
         21        SEND_VAL                                                 '_'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                         $15     
         24        ASSIGN                                                   !4, $15
   15    25        CONCAT                                           ~17     !4, '%0A'
         26        ECHO                                                     ~17
   16    27        INIT_FCALL                                               'preg_replace'
         28        SEND_VAL                                                 <array>
   17    29        SEND_VAL                                                 <array>
   18    30        SEND_VAR                                                 !4
         31        DO_ICALL                                         $18     
   16    32        ASSIGN                                                   !4, $18
   20    33        CONCAT                                           ~20     !4, '%0A'
         34        ECHO                                                     ~20
   21    35        INIT_FCALL                                               'in_array'
         36        SEND_VAR                                                 !4
         37        SEND_VAR                                                 !2
         38        DO_ICALL                                         $21     
         39      > JMPZ                                                     $21, ->42
         40    >   QM_ASSIGN                                        ~22     'is+valid+sa'
         41      > JMP                                                      ->43
         42    >   QM_ASSIGN                                        ~22     'is+not+valid+sa'
         43    >   ECHO                                                     ~22
         44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.71 ms | 1400 KiB | 25 Q