3v4l.org

run code in 300+ PHP versions simultaneously
<?php $Code ='Q) A. We were watching television last night. B. We was watching television last night. A) a) A b) B Q) Four words are given below out of which three words have similar meaning. Find the odd word which has a different meaning. E.g.: A) a) speak b) discuss c) converse d) comprehend '; function explodeX($delimiters,$string) { $return_array = Array($string); // The array to return $d_count = 0; while (isset($delimiters[$d_count])) // Loop to loop through all delimiters { $new_return_array = Array(); foreach($return_array as $el_to_split) // Explode all returned elements by the next delimiter { $put_in_new_return_array = explode($delimiters[$d_count],$el_to_split); foreach($put_in_new_return_array as $substr) // Put all the exploded elements in array to return { $new_return_array[] = $substr; } } $return_array = $new_return_array; // Replace the previous return array by the next version $d_count++; } return $return_array; // Return the exploded elements } $output = explodeX(Array("Q)","A)"), $Code); //Calling the function using the split parameters echo $output[1]; //echo $output[2]; $your_array = explode(") ", $output[2]); echo $your_array[0]; echo $your_array[1]; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oCjPB
function name:  (null)
number of ops:  19
compiled vars:  !0 = $Code, !1 = $output, !2 = $your_array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Q%29%0AA.+We+were+watching+television+last+night.%0AB.+We+was+watching+television+last+night.%0AA%29%0Aa%29+A%0Ab%29+B%0AQ%29%0AFour+words+are+given+below+out+of+which+three+words+have+similar+meaning.+Find+the+odd+word+which+has+a+different+meaning.%0AE.g.%3A+%0AA%29%0Aa%29+speak%0Ab%29+discuss%0Ac%29+converse%0Ad%29+comprehend%0A'
   56     1        INIT_FCALL                                               'explodex'
          2        SEND_VAL                                                 <array>
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !1, $4
   60     6        FETCH_DIM_R                                      ~6      !1, 1
          7        ECHO                                                     ~6
   62     8        INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '%29+'
         10        FETCH_DIM_R                                      ~7      !1, 2
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                         $8      
         13        ASSIGN                                                   !2, $8
   63    14        FETCH_DIM_R                                      ~10     !2, 0
         15        ECHO                                                     ~10
   64    16        FETCH_DIM_R                                      ~11     !2, 1
         17        ECHO                                                     ~11
   65    18      > RETURN                                                   1

Function explodex:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 6
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 22
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 22
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 20
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 6
Branch analysis from position: 27
Branch analysis from position: 6
Branch analysis from position: 22
filename:       /in/oCjPB
function name:  explodeX
number of ops:  29
compiled vars:  !0 = $delimiters, !1 = $string, !2 = $return_array, !3 = $d_count, !4 = $new_return_array, !5 = $el_to_split, !6 = $put_in_new_return_array, !7 = $substr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   21     2        INIT_ARRAY                                       ~8      !1
          3        ASSIGN                                                   !2, ~8
   23     4        ASSIGN                                                   !3, 0
   25     5      > JMP                                                      ->25
   29     6    >   ASSIGN                                                   !4, <array>
   31     7      > FE_RESET_R                                       $12     !2, ->22
          8    > > FE_FETCH_R                                               $12, !5, ->22
   35     9    >   INIT_FCALL                                               'explode'
         10        FETCH_DIM_R                                      ~13     !0, !3
         11        SEND_VAL                                                 ~13
         12        SEND_VAR                                                 !5
         13        DO_ICALL                                         $14     
         14        ASSIGN                                                   !6, $14
   37    15      > FE_RESET_R                                       $16     !6, ->20
         16    > > FE_FETCH_R                                               $16, !7, ->20
   41    17    >   ASSIGN_DIM                                               !4
         18        OP_DATA                                                  !7
   37    19      > JMP                                                      ->16
         20    >   FE_FREE                                                  $16
   31    21      > JMP                                                      ->8
         22    >   FE_FREE                                                  $12
   47    23        ASSIGN                                                   !2, !4
   49    24        PRE_INC                                                  !3
   25    25    >   ISSET_ISEMPTY_DIM_OBJ                         0          !0, !3
         26      > JMPNZ                                                    ~20, ->6
   53    27    > > RETURN                                                   !2
   55    28*     > RETURN                                                   null

End of function explodex

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.89 ms | 1403 KiB | 16 Q