3v4l.org

run code in 300+ PHP versions simultaneously
<?php $paradasarray = [ (object)['localidad' => 'Estepona whatever'], (object)['localidad' => 'something Benalmádena'], (object)['localidad' => 'Benalmádena foo'], (object)['localidad' => 'Estepona bar'] ]; $result = []; foreach ($paradasarray as $i => $parada) { echo "iteration #$i\n"; if (strpos($parada->localidad, 'Benalmádena') !== false) { $result['Benalmádena'] = "Benalmádena Costa"; } elseif (strpos($parada->localidad, 'Estepona') !== false) { $result['Estepona'] = 'Estepona'; } if (count($result) == 2) { break; } } // you don't need to declare a value attribute if it matches the text echo "<select>\n"; echo "\t<option>" , implode("</option>\n\t<option>", $result) , "</option>\n"; echo "</select>";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 41
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 41
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 27
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 40
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 40
Branch analysis from position: 39
Branch analysis from position: 40
Branch analysis from position: 36
Branch analysis from position: 41
Branch analysis from position: 41
filename:       /in/ZecRC
function name:  (null)
number of ops:  52
compiled vars:  !0 = $paradasarray, !1 = $result, !2 = $parada, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   CAST                                          8  ~4      <array>
          1        INIT_ARRAY                                       ~5      ~4
    4     2        CAST                                          8  ~6      <array>
          3        ADD_ARRAY_ELEMENT                                ~5      ~6
    5     4        CAST                                          8  ~7      <array>
          5        ADD_ARRAY_ELEMENT                                ~5      ~7
    6     6        CAST                                          8  ~8      <array>
          7        ADD_ARRAY_ELEMENT                                ~5      ~8
    2     8        ASSIGN                                                   !0, ~5
    9     9        ASSIGN                                                   !1, <array>
   10    10      > FE_RESET_R                                       $11     !0, ->41
         11    > > FE_FETCH_R                                       ~12     $11, !2, ->41
         12    >   ASSIGN                                                   !3, ~12
   11    13        ROPE_INIT                                     3  ~15     'iteration+%23'
         14        ROPE_ADD                                      1  ~15     ~15, !3
         15        ROPE_END                                      2  ~14     ~15, '%0A'
         16        ECHO                                                     ~14
   12    17        INIT_FCALL                                               'strpos'
         18        FETCH_OBJ_R                                      ~17     !2, 'localidad'
         19        SEND_VAL                                                 ~17
         20        SEND_VAL                                                 'Benalm%C3%A1dena'
         21        DO_ICALL                                         $18     
         22        TYPE_CHECK                                  1018          $18
         23      > JMPZ                                                     ~19, ->27
   13    24    >   ASSIGN_DIM                                               !1, 'Benalm%C3%A1dena'
         25        OP_DATA                                                  'Benalm%C3%A1dena+Costa'
   12    26      > JMP                                                      ->36
   14    27    >   INIT_FCALL                                               'strpos'
         28        FETCH_OBJ_R                                      ~21     !2, 'localidad'
         29        SEND_VAL                                                 ~21
         30        SEND_VAL                                                 'Estepona'
         31        DO_ICALL                                         $22     
         32        TYPE_CHECK                                  1018          $22
         33      > JMPZ                                                     ~23, ->36
   15    34    >   ASSIGN_DIM                                               !1, 'Estepona'
         35        OP_DATA                                                  'Estepona'
   17    36    >   COUNT                                            ~25     !1
         37        IS_EQUAL                                                 ~25, 2
         38      > JMPZ                                                     ~26, ->40
   18    39    > > JMP                                                      ->41
   10    40    > > JMP                                                      ->11
         41    >   FE_FREE                                                  $11
   23    42        ECHO                                                     '%3Cselect%3E%0A'
   24    43        ECHO                                                     '%09%3Coption%3E'
         44        INIT_FCALL                                               'implode'
         45        SEND_VAL                                                 '%3C%2Foption%3E%0A%09%3Coption%3E'
         46        SEND_VAR                                                 !1
         47        DO_ICALL                                         $27     
         48        ECHO                                                     $27
         49        ECHO                                                     '%3C%2Foption%3E%0A'
   25    50        ECHO                                                     '%3C%2Fselect%3E'
         51      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
267.08 ms | 1011 KiB | 15 Q