3v4l.org

run code in 300+ PHP versions simultaneously
<?php foreach (['pattern-64587989', 'pattern,6458-7989'] as $searchParam) { $parts = explode('-', $searchParam); if (count($parts) > 0 && strpos($parts[0], ',') === false) { list($key, $value) = $parts; // or better: [$key, $value] = $parts; echo "$key: $value\n"; } else { echo "Nope\n"; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 1, Position 2 = 32
Branch analysis from position: 1
2 jumps found. (Code = 78) Position 1 = 2, Position 2 = 32
Branch analysis from position: 2
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 30
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 1
Branch analysis from position: 1
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 1
Branch analysis from position: 1
Branch analysis from position: 17
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/mQX7n
function name:  (null)
number of ops:  34
compiled vars:  !0 = $searchParam, !1 = $parts, !2 = $key, !3 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E > > FE_RESET_R                                       $4      <array>, ->32
          1    > > FE_FETCH_R                                               $4, !0, ->32
    3     2    >   INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '-'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !1, $5
    5     7        COUNT                                            ~7      !1
          8        IS_SMALLER                                       ~8      0, ~7
          9      > JMPZ_EX                                          ~8      ~8, ->17
         10    >   INIT_FCALL                                               'strpos'
         11        FETCH_DIM_R                                      ~9      !1, 0
         12        SEND_VAL                                                 ~9
         13        SEND_VAL                                                 '%2C'
         14        DO_ICALL                                         $10     
         15        TYPE_CHECK                                    4  ~11     $10
         16        BOOL                                             ~8      ~11
         17    > > JMPZ                                                     ~8, ->30
    6    18    >   QM_ASSIGN                                        ~12     !1
         19        FETCH_LIST_R                                     $13     ~12, 0
         20        ASSIGN                                                   !2, $13
         21        FETCH_LIST_R                                     $15     ~12, 1
         22        ASSIGN                                                   !3, $15
         23        FREE                                                     ~12
    7    24        ROPE_INIT                                     4  ~18     !2
         25        ROPE_ADD                                      1  ~18     ~18, '%3A+'
         26        ROPE_ADD                                      2  ~18     ~18, !3
         27        ROPE_END                                      3  ~17     ~18, '%0A'
         28        ECHO                                                     ~17
         29      > JMP                                                      ->31
    9    30    >   ECHO                                                     'Nope%0A'
    2    31    > > JMP                                                      ->1
         32    >   FE_FREE                                                  $4
   11    33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.22 ms | 1401 KiB | 17 Q