3v4l.org

run code in 300+ PHP versions simultaneously
<?php $emails = array( 'mail1@gmail.com', 'mail2@gmail.com', 'mail3@gmail.com', 'mail4@gmail.com', 'mail5@gmail.com', 'mail1@yahoo.com', 'mail2@yahoo.com', 'mail3@yahoo.com', 'mail4@yahoo.com', 'mail5@yahoo.com', 'mail1@aol.com', 'mail2@aol.com', 'mail3@aol.com', 'mail4@aol.com', 'mail5@aol.com', 'mail1@e.com', 'mail2@others.com', 'mail3@d.com', 'mail4@others.com', 'mail5@z.com', ); $organized_emails = array(); $needle_key = 0; $needle_search = array('gmail', 'yahoo', 'aol', 'others'); while(true) { $current_value = array_shift($emails); if(strpos($current_value, $needle_search[$needle_key]) !== false) { $organized_emails[] = $current_value; $needle_key++; if($needle_key > 3) { $needle_key = 0; } } else { array_push($emails, $current_value); } if(empty($emails)) { break; } } echo '<pre>'; print_r($organized_emails); echo '</pre>';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 5
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 30
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 30
Branch analysis from position: 22
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 30
Branch analysis from position: 29
Branch analysis from position: 30
filename:       /in/PqR7a
function name:  (null)
number of ops:  37
compiled vars:  !0 = $emails, !1 = $organized_emails, !2 = $needle_key, !3 = $needle_search, !4 = $current_value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   30     1        ASSIGN                                                   !1, <array>
   31     2        ASSIGN                                                   !2, 0
   32     3        ASSIGN                                                   !3, <array>
   34     4      > JMP                                                      ->30
   35     5    >   INIT_FCALL                                               'array_shift'
          6        SEND_REF                                                 !0
          7        DO_ICALL                                         $9      
          8        ASSIGN                                                   !4, $9
   36     9        INIT_FCALL                                               'strpos'
         10        SEND_VAR                                                 !4
         11        FETCH_DIM_R                                      ~11     !3, !2
         12        SEND_VAL                                                 ~11
         13        DO_ICALL                                         $12     
         14        TYPE_CHECK                                  1018          $12
         15      > JMPZ                                                     ~13, ->23
   37    16    >   ASSIGN_DIM                                               !1
         17        OP_DATA                                                  !4
   38    18        PRE_INC                                                  !2
   39    19        IS_SMALLER                                               3, !2
         20      > JMPZ                                                     ~16, ->22
   40    21    >   ASSIGN                                                   !2, 0
         22    > > JMP                                                      ->27
   43    23    >   INIT_FCALL                                               'array_push'
         24        SEND_REF                                                 !0
         25        SEND_VAR                                                 !4
         26        DO_ICALL                                                 
   46    27    >   ISSET_ISEMPTY_CV                                         !0
         28      > JMPZ                                                     ~19, ->30
   47    29    > > JMP                                                      ->31
   34    30    > > JMPNZ                                                    <true>, ->5
   51    31    >   ECHO                                                     '%3Cpre%3E'
   52    32        INIT_FCALL                                               'print_r'
         33        SEND_VAR                                                 !1
         34        DO_ICALL                                                 
   53    35        ECHO                                                     '%3C%2Fpre%3E'
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.75 ms | 1400 KiB | 21 Q