3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = Array( '0' => Array ( '0' => '5522 8600 0000 0000', '1' => '2020', '2' => '09' ), '1' => Array ( '0' => '09', '1' => '5522 8600 0000 0000', '2' => '2020' ), '2' => Array ( '0' => '5522 8600 0000 0000', '1' => '20', '2' => '9' ) ); $finalArray = []; foreach($array as $key=>$arr){ $arry = []; foreach($arr as $ar){ if(strlen($ar) > 4){ $arry[0] = $ar; }else if((strlen($ar) ==1 || strlen($ar) == 2) && (int)$ar <=12){ $arry[1] = $ar; }else{ $arry[2] = $ar; } } ksort($arry); $finalArray[$key] = $arry; } print_r($finalArray);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 38
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 38
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 31
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 31
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 14
2 jumps found. (Code = 47) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 28
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 24
Branch analysis from position: 20
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 31
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
filename:       /in/BZIFX
function name:  (null)
number of ops:  43
compiled vars:  !0 = $array, !1 = $finalArray, !2 = $arr, !3 = $key, !4 = $arry, !5 = $ar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   26     1        ASSIGN                                                   !1, <array>
   27     2      > FE_RESET_R                                       $8      !0, ->38
          3    > > FE_FETCH_R                                       ~9      $8, !2, ->38
          4    >   ASSIGN                                                   !3, ~9
   28     5        ASSIGN                                                   !4, <array>
   29     6      > FE_RESET_R                                       $12     !2, ->31
          7    > > FE_FETCH_R                                               $12, !5, ->31
   31     8    >   STRLEN                                           ~13     !5
          9        IS_SMALLER                                               4, ~13
         10      > JMPZ                                                     ~14, ->14
   32    11    >   ASSIGN_DIM                                               !4, 0
         12        OP_DATA                                                  !5
   31    13      > JMP                                                      ->30
   33    14    >   STRLEN                                           ~16     !5
         15        IS_EQUAL                                         ~17     ~16, 1
         16      > JMPNZ_EX                                         ~17     ~17, ->20
         17    >   STRLEN                                           ~18     !5
         18        IS_EQUAL                                         ~19     ~18, 2
         19        BOOL                                             ~17     ~19
         20    > > JMPZ_EX                                          ~17     ~17, ->24
         21    >   CAST                                          4  ~20     !5
         22        IS_SMALLER_OR_EQUAL                              ~21     ~20, 12
         23        BOOL                                             ~17     ~21
         24    > > JMPZ                                                     ~17, ->28
   34    25    >   ASSIGN_DIM                                               !4, 1
         26        OP_DATA                                                  !5
   33    27      > JMP                                                      ->30
   36    28    >   ASSIGN_DIM                                               !4, 2
         29        OP_DATA                                                  !5
   29    30    > > JMP                                                      ->7
         31    >   FE_FREE                                                  $12
   39    32        INIT_FCALL                                               'ksort'
         33        SEND_REF                                                 !4
         34        DO_ICALL                                                 
   40    35        ASSIGN_DIM                                               !1, !3
         36        OP_DATA                                                  !4
   27    37      > JMP                                                      ->3
         38    >   FE_FREE                                                  $8
   43    39        INIT_FCALL                                               'print_r'
         40        SEND_VAR                                                 !1
         41        DO_ICALL                                                 
         42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.53 ms | 1004 KiB | 15 Q