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"), array("name"=>"...", "gender"=>"male"), array("name"=>"...", "gender"=>"female"), ); $i = 0; $j = 1; foreach($students as $stu){ if($stu['gender'] == 'male'){ $male[$i] = $stu; $i +=2; }else{ $female[$j] = $stu; $j +=2; } } $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 = 4, Position 2 = 16
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 16
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/k3MMj
function name:  (null)
number of ops:  33
compiled vars:  !0 = $students, !1 = $i, !2 = $j, !3 = $stu, !4 = $male, !5 = $female, !6 = $all
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   19     1        ASSIGN                                                   !1, 0
   20     2        ASSIGN                                                   !2, 1
   21     3      > FE_RESET_R                                       $10     !0, ->16
          4    > > FE_FETCH_R                                               $10, !3, ->16
   22     5    >   FETCH_DIM_R                                      ~11     !3, 'gender'
          6        IS_EQUAL                                                 ~11, 'male'
          7      > JMPZ                                                     ~12, ->12
   23     8    >   ASSIGN_DIM                                               !4, !1
          9        OP_DATA                                                  !3
   24    10        ASSIGN_OP                                     1          !1, 2
         11      > JMP                                                      ->15
   26    12    >   ASSIGN_DIM                                               !5, !2
         13        OP_DATA                                                  !3
   27    14        ASSIGN_OP                                     1          !2, 2
   21    15    > > JMP                                                      ->4
         16    >   FE_FREE                                                  $10
   31    17        INIT_FCALL                                               'array_replace'
         18        SEND_VAR                                                 !4
         19        SEND_VAR                                                 !5
         20        DO_ICALL                                         $17     
         21        ASSIGN                                                   !6, $17
   32    22        INIT_FCALL                                               'ksort'
         23        SEND_REF                                                 !6
         24        DO_ICALL                                                 
   33    25        INIT_FCALL                                               'array_values'
         26        SEND_VAR                                                 !6
         27        DO_ICALL                                         $20     
         28        ASSIGN                                                   !6, $20
   35    29        INIT_FCALL                                               'var_dump'
         30        SEND_VAR                                                 !6
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.62 ms | 1396 KiB | 21 Q