3v4l.org

run code in 300+ PHP versions simultaneously
<?php $students= array( array("name"=>"...", "gender"=>"male"), array("name"=>"...", "gender"=>"female"), array("name"=>"...", "gender"=>"female"), array("name"=>"...", "gender"=>"female"), array("name"=>"...", "gender"=>"male"), array("name"=>"...", "gender"=>"male"), array("name"=>"...", "gender"=>"male"), array("name"=>"...", "gender"=>"male"), array("name"=>"...", "gender"=>"male"), ); foreach($students as $stu){ if($stu['gender'] == 'male'){ $male[] = $stu; }else{ $female[] = $stu; } } $male = array_combine(Range(0,(count($male)-1)*2,2),$male); $female = array_combine(Range(1,count($female)*2,2),$female); $all = array_replace($male, $female); ksort($all); $all = array_values($all); var_dump($all);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 12
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/TZCKN
function name:  (null)
number of ops:  54
compiled vars:  !0 = $students, !1 = $stu, !2 = $male, !3 = $female, !4 = $all
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1      > FE_RESET_R                                       $6      !0, ->12
          2    > > FE_FETCH_R                                               $6, !1, ->12
   18     3    >   FETCH_DIM_R                                      ~7      !1, 'gender'
          4        IS_EQUAL                                                 ~7, 'male'
          5      > JMPZ                                                     ~8, ->9
   19     6    >   ASSIGN_DIM                                               !2
          7        OP_DATA                                                  !1
   18     8      > JMP                                                      ->11
   21     9    >   ASSIGN_DIM                                               !3
         10        OP_DATA                                                  !1
   17    11    > > JMP                                                      ->2
         12    >   FE_FREE                                                  $6
   26    13        INIT_FCALL                                               'array_combine'
         14        INIT_FCALL                                               'range'
         15        SEND_VAL                                                 0
         16        COUNT                                            ~11     !2
         17        SUB                                              ~12     ~11, 1
         18        MUL                                              ~13     ~12, 2
         19        SEND_VAL                                                 ~13
         20        SEND_VAL                                                 2
         21        DO_ICALL                                         $14     
         22        SEND_VAR                                                 $14
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                         $15     
         25        ASSIGN                                                   !2, $15
   27    26        INIT_FCALL                                               'array_combine'
         27        INIT_FCALL                                               'range'
         28        SEND_VAL                                                 1
         29        COUNT                                            ~17     !3
         30        MUL                                              ~18     ~17, 2
         31        SEND_VAL                                                 ~18
         32        SEND_VAL                                                 2
         33        DO_ICALL                                         $19     
         34        SEND_VAR                                                 $19
         35        SEND_VAR                                                 !3
         36        DO_ICALL                                         $20     
         37        ASSIGN                                                   !3, $20
   28    38        INIT_FCALL                                               'array_replace'
         39        SEND_VAR                                                 !2
         40        SEND_VAR                                                 !3
         41        DO_ICALL                                         $22     
         42        ASSIGN                                                   !4, $22
   29    43        INIT_FCALL                                               'ksort'
         44        SEND_REF                                                 !4
         45        DO_ICALL                                                 
   30    46        INIT_FCALL                                               'array_values'
         47        SEND_VAR                                                 !4
         48        DO_ICALL                                         $25     
         49        ASSIGN                                                   !4, $25
   32    50        INIT_FCALL                                               'var_dump'
         51        SEND_VAR                                                 !4
         52        DO_ICALL                                                 
         53      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.55 ms | 1012 KiB | 19 Q