3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "days=Mon&days=Wed" . "&fruit[1]=Apple&fruit[]=Banana&amp;age=13"; parse_str($str, $output); // gettype will return 'array' or 'string' echo gettype($output['days']); echo ' - '; // array_search will return the key // where the first argument is located echo array_search('Banana', $output['fruit']); echo ' - '; echo array_key_exists('age', $output) ? $output['age'] : 0; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 21
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Kk6HJ
function name:  (null)
number of ops:  24
compiled vars:  !0 = $str, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'days%3DMon%26days%3DWed%26fruit%5B1%5D%3DApple%26fruit%5B%5D%3DBanana%26amp%3Bage%3D13'
    5     1        INIT_FCALL                                               'parse_str'
          2        SEND_VAR                                                 !0
          3        SEND_REF                                                 !1
          4        DO_ICALL                                                 
    8     5        FETCH_DIM_R                                      ~4      !1, 'days'
          6        GET_TYPE                                         ~5      ~4
          7        ECHO                                                     ~5
   10     8        ECHO                                                     '+-+'
   14     9        INIT_FCALL                                               'array_search'
         10        SEND_VAL                                                 'Banana'
         11        FETCH_DIM_R                                      ~6      !1, 'fruit'
         12        SEND_VAL                                                 ~6
         13        DO_ICALL                                         $7      
         14        ECHO                                                     $7
   16    15        ECHO                                                     '+-+'
   18    16        ARRAY_KEY_EXISTS                                         'age', !1
         17      > JMPZ                                                     ~8, ->21
         18    >   FETCH_DIM_R                                      ~9      !1, 'age'
         19        QM_ASSIGN                                        ~10     ~9
         20      > JMP                                                      ->22
         21    >   QM_ASSIGN                                        ~10     0
         22    >   ECHO                                                     ~10
   19    23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.51 ms | 1387 KiB | 17 Q