3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = "destination=Apartment+TITLIS+Resort+Wohnung+721&hotelid=0123454656"; if (($pos = strpos($data, "=")) !== FALSE) { $whatIWant = ucwords(substr($data, $pos+1)); $whatIWant = explode("&", $whatIWant); $whatIWant = $whatIWant[0]; echo "Ans1: \n"; echo $whatIWant; // Output: Apartment+TITLIS+Resort+Wohnung+721 // if you want your output with & just add & echo "\n\nAns2: \n"; $whatIWant = $whatIWant."&"; echo $whatIWant; // now Output iss: // Apartment+TITLIS+Resort+Wohnung+721& } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 30
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/ohgvE
function name:  (null)
number of ops:  31
compiled vars:  !0 = $data, !1 = $pos, !2 = $whatIWant
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'destination%3DApartment%2BTITLIS%2BResort%2BWohnung%2B721%26hotelid%3D0123454656'
    3     1        INIT_FCALL                                               'strpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%3D'
          4        DO_ICALL                                         $4      
          5        ASSIGN                                           ~5      !1, $4
          6        TYPE_CHECK                                  1018          ~5
          7      > JMPZ                                                     ~6, ->30
    4     8    >   INIT_FCALL                                               'ucwords'
          9        INIT_FCALL                                               'substr'
         10        SEND_VAR                                                 !0
         11        ADD                                              ~7      !1, 1
         12        SEND_VAL                                                 ~7
         13        DO_ICALL                                         $8      
         14        SEND_VAR                                                 $8
         15        DO_ICALL                                         $9      
         16        ASSIGN                                                   !2, $9
    5    17        INIT_FCALL                                               'explode'
         18        SEND_VAL                                                 '%26'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $11     
         21        ASSIGN                                                   !2, $11
    6    22        FETCH_DIM_R                                      ~13     !2, 0
         23        ASSIGN                                                   !2, ~13
    7    24        ECHO                                                     'Ans1%3A+%0A'
    8    25        ECHO                                                     !2
   11    26        ECHO                                                     '%0A%0AAns2%3A+%0A'
   13    27        CONCAT                                           ~15     !2, '%26'
         28        ASSIGN                                                   !2, ~15
   15    29        ECHO                                                     !2
   20    30    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.89 ms | 1396 KiB | 21 Q