3v4l.org

run code in 300+ PHP versions simultaneously
<?php function removeQuestionMarks($URL){ if(preg_match('/^http(s)?:\/\/example\.com\/forum\/.*$/',$URL) === 1){ $URL = trim($URL); $URL = str_replace("?","",$URL); } return str_replace([' ', '&'],['%20', '&amp;'],$URL); } echo removeQuestionMarks('https://example.com/forum/post/work/22/what-are-requirements-to-get-a-work-permit?/24'),PHP_EOL; echo removeQuestionMarks('https://example.com/forum/ why? is it difficult?/877');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FXDml
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'removequestionmarks'
          1        SEND_VAL                                                 'https%3A%2F%2Fexample.com%2Fforum%2Fpost%2Fwork%2F22%2Fwhat-are-requirements-to-get-a-work-permit%3F%2F24'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4        ECHO                                                     '%0A'
   14     5        INIT_FCALL                                               'removequestionmarks'
          6        SEND_VAL                                                 'https%3A%2F%2Fexample.com%2Fforum%2F+why%3F+is+it+difficult%3F%2F877'
          7        DO_FCALL                                      0  $1      
          8        ECHO                                                     $1
          9      > RETURN                                                   1

Function removequestionmarks:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/FXDml
function name:  removeQuestionMarks
number of ops:  24
compiled vars:  !0 = $URL
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%5Ehttp%28s%29%3F%3A%5C%2F%5C%2Fexample%5C.com%5C%2Fforum%5C%2F.%2A%24%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        IS_IDENTICAL                                             $1, 1
          6      > JMPZ                                                     ~2, ->17
    5     7    >   INIT_FCALL                                               'trim'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $3      
         10        ASSIGN                                                   !0, $3
    6    11        INIT_FCALL                                               'str_replace'
         12        SEND_VAL                                                 '%3F'
         13        SEND_VAL                                                 ''
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $5      
         16        ASSIGN                                                   !0, $5
    9    17    >   INIT_FCALL                                               'str_replace'
         18        SEND_VAL                                                 <array>
         19        SEND_VAL                                                 <array>
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                         $7      
         22      > RETURN                                                   $7
   10    23*     > RETURN                                                   null

End of function removequestionmarks

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.08 ms | 1442 KiB | 18 Q