3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = array ( 82 => array ( 'APBKID' => '83', 'KodeRekening' => '3', 'LevelRekening' => NULL, 'KodeRekeningInduk' => NULL, 'Uraian' => 'PEMBIAYAAN', 'Anggaran' => '0', 'Keterangan' => NULL, 'TahunAnggaran' => '2019', 'KampungID' => '1', 'DanaDesa' => NULL, 'AlokasiDanaDesa' => NULL, 'CreatedAt' => '2019-08-10 18: 20: 36', 'CreatedBy' => '1', 'UpdatedAt' => '2019-09-06 12: 31: 21', 'UpdatedBy' => '1', 'Deleted' => '0', 'DistrikID' => '1', 'NamaKampung' => 'Amungun', 'KepalaKampung' => 'Joni Niwilingame', 'FotoKepalaKampung' => '', 'KodeRegisterKampung' => '91.09.02', 'GambarKampung' => 'splash.jpg', 'ProfilKampung' => '<p><strong style="margin: 0px; padding: 0px; font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">Lorem Ipsum</strong><span style="font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">&nbsp;is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</span><br></p>', ), 83 => array ( 'APBKID' => '84', 'KodeRekening' => '3.1', 'LevelRekening' => NULL, 'KodeRekeningInduk' => NULL, 'Uraian' => 'Penerimaan Pembiayaan ', 'Anggaran' => '99475000', 'Keterangan' => NULL, 'TahunAnggaran' => '2019', 'KampungID' => '1', 'DanaDesa' => NULL, 'AlokasiDanaDesa' => NULL, 'CreatedAt' => '2019-08-10 18: 20: 36', 'CreatedBy' => '1', 'UpdatedAt' => '2019-09-06 12: 31: 21', 'UpdatedBy' => '1', 'Deleted' => '0', 'DistrikID' => '1', 'NamaKampung' => 'Amungun', 'KepalaKampung' => 'Joni Niwilingame', 'FotoKepalaKampung' => '', 'KodeRegisterKampung' => '91.09.02', 'GambarKampung' => 'splash.jpg', 'ProfilKampung' => '<p><strong style="margin: 0px; padding: 0px; font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">Lorem Ipsum</strong><span style="font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">&nbsp;is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</span><br></p>', ), 84 => array ( 'APBKID' => '85', 'KodeRekening' => '3.1.1', 'LevelRekening' => NULL, 'KodeRekeningInduk' => NULL, 'Uraian' => 'SILPA ', 'Anggaran' => '99475000', 'Keterangan' => NULL, 'TahunAnggaran' => '2019', 'KampungID' => '1', 'DanaDesa' => NULL, 'AlokasiDanaDesa' => NULL, 'CreatedAt' => '2019-08-10 18: 20: 36', 'CreatedBy' => '1', 'UpdatedAt' => '2019-09-06 12: 31: 21', 'UpdatedBy' => '1', 'Deleted' => '0', 'DistrikID' => '1', 'NamaKampung' => 'Amungun', 'KepalaKampung' => 'Joni Niwilingame', 'FotoKepalaKampung' => '', 'KodeRegisterKampung' => '91.09.02', 'GambarKampung' => 'splash.jpg', 'ProfilKampung' => '<p><strong style="margin: 0px; padding: 0px; font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">Lorem Ipsum</strong><span style="font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">&nbsp;is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</span><br></p>', ), 85 => array ( 'APBKID' => '86', 'KodeRekening' => '3.1.2', 'LevelRekening' => NULL, 'KodeRekeningInduk' => NULL, 'Uraian' => 'Pencairan Dana Cadangan ', 'Anggaran' => '0', 'Keterangan' => NULL, 'TahunAnggaran' => '2019', 'KampungID' => '1', 'DanaDesa' => NULL, 'AlokasiDanaDesa' => NULL, 'CreatedAt' => '2019-08-10 18: 20: 36', 'CreatedBy' => '1', 'UpdatedAt' => '2019-09-06 12: 31: 21', 'UpdatedBy' => '1', 'Deleted' => '0', 'DistrikID' => '1', 'NamaKampung' => 'Amungun', 'KepalaKampung' => 'Joni Niwilingame', 'FotoKepalaKampung' => '', 'KodeRegisterKampung' => '91.09.02', 'GambarKampung' => 'splash.jpg', 'ProfilKampung' => '<p><strong style="margin: 0px; padding: 0px; font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">Lorem Ipsum</strong><span style="font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">&nbsp;is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</span><br></p>', ), 86 => array ( 'APBKID' => '87', 'KodeRekening' => '3.1.3', 'LevelRekening' => NULL, 'KodeRekeningInduk' => NULL, 'Uraian' => 'Hasil Kekayaan Desa Yang dipisahkan ', 'Anggaran' => '0', 'Keterangan' => NULL, 'TahunAnggaran' => '2019', 'KampungID' => '1', 'DanaDesa' => NULL, 'AlokasiDanaDesa' => NULL, 'CreatedAt' => '2019-08-10 18: 20: 36', 'CreatedBy' => '1', 'UpdatedAt' => '2019-09-06 12: 31: 21', 'UpdatedBy' => '1', 'Deleted' => '0', 'DistrikID' => '1', 'NamaKampung' => 'Amungun', 'KepalaKampung' => 'Joni Niwilingame', 'FotoKepalaKampung' => '', 'KodeRegisterKampung' => '91.09.02', 'GambarKampung' => 'splash.jpg', 'ProfilKampung' => '<p><strong style="margin: 0px; padding: 0px; font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">Lorem Ipsum</strong><span style="font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">&nbsp;is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</span><br></p>', ), 87 => array ( 'APBKID' => '88', 'KodeRekening' => '3.2', 'LevelRekening' => NULL, 'KodeRekeningInduk' => NULL, 'Uraian' => 'Pengeluaran Pembiayaan ', 'Anggaran' => '0', 'Keterangan' => NULL, 'TahunAnggaran' => '2019', 'KampungID' => '1', 'DanaDesa' => NULL, 'AlokasiDanaDesa' => NULL, 'CreatedAt' => '2019-08-10 18: 20: 36', 'CreatedBy' => '1', 'UpdatedAt' => '2019-09-06 12: 31: 21', 'UpdatedBy' => '1', 'Deleted' => '0', 'DistrikID' => '1', 'NamaKampung' => 'Amungun', 'KepalaKampung' => 'Joni Niwilingame', 'FotoKepalaKampung' => '', 'KodeRegisterKampung' => '91.09.02', 'GambarKampung' => 'splash.jpg', 'ProfilKampung' => '<p><strong style="margin: 0px; padding: 0px; font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">Lorem Ipsum</strong><span style="font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">&nbsp;is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</span><br></p>', ), 88 => array ( 'APBKID' => '89', 'KodeRekening' => '3.2.1', 'LevelRekening' => NULL, 'KodeRekeningInduk' => NULL, 'Uraian' => 'Pembentukan Dana Cadangan ', 'Anggaran' => '0', 'Keterangan' => NULL, 'TahunAnggaran' => '2019', 'KampungID' => '1', 'DanaDesa' => NULL, 'AlokasiDanaDesa' => NULL, 'CreatedAt' => '2019-08-10 18: 20: 36', 'CreatedBy' => '1', 'UpdatedAt' => '2019-09-06 12: 31: 21', 'UpdatedBy' => '1', 'Deleted' => '0', 'DistrikID' => '1', 'NamaKampung' => 'Amungun', 'KepalaKampung' => 'Joni Niwilingame', 'FotoKepalaKampung' => '', 'KodeRegisterKampung' => '91.09.02', 'GambarKampung' => 'splash.jpg', 'ProfilKampung' => '<p><strong style="margin: 0px; padding: 0px; font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">Lorem Ipsum</strong><span style="font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">&nbsp;is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</span><br></p>', ), 89 => array ( 'APBKID' => '90', 'KodeRekening' => '3.2.2', 'LevelRekening' => NULL, 'KodeRekeningInduk' => NULL, 'Uraian' => 'Penyertaan Modal Desa ', 'Anggaran' => '0', 'Keterangan' => NULL, 'TahunAnggaran' => '2019', 'KampungID' => '1', 'DanaDesa' => NULL, 'AlokasiDanaDesa' => NULL, 'CreatedAt' => '2019-08-10 18: 20: 36', 'CreatedBy' => '1', 'UpdatedAt' => '2019-09-06 12: 31: 21', 'UpdatedBy' => '1', 'Deleted' => '0', 'DistrikID' => '1', 'NamaKampung' => 'Amungun', 'KepalaKampung' => 'Joni Niwilingame', 'FotoKepalaKampung' => '', 'KodeRegisterKampung' => '91.09.02', 'GambarKampung' => 'splash.jpg', 'ProfilKampung' => '<p><strong style="margin: 0px; padding: 0px; font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">Lorem Ipsum</strong><span style="font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">&nbsp;is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</span><br></p>', ) ); usort($arr,function($array1,$array2){ $version_1 = explode(".",$array1['KodeRekening']); $version_2 = explode(".",$array2['KodeRekening']); $size_1 = count($version_1); $size_2 = count($version_2); $min_size = min($size_1,$size_2); for($i=0;$i<$min_size;++$i){ if(intval($version_1[$i]) < intval($version_2[$i])){ return -1; }else if(intval($version_1[$i]) > intval($version_2[$i])){ return 1; } } return $size_1 - $size_2; }); $set = []; $result = []; foreach($arr as $curr){ $version = $curr['KodeRekening']; $parent_version = implode(".",array_slice(explode(".",$version),0,-1)); if(isset($set[$parent_version])){ $parent_element = &$set[$parent_version]; if(!isset($parent_element['data'])) $parent_element['data'] = []; $parent_element['data'][] = $curr; $set[$version] = &$parent_element['data'][lastIndex($parent_element['data'])]; }else{ $result[] = $curr; $set[$version] = &$result[lastIndex($result)]; } } function lastIndex($arr){ $keys = array_keys($arr); return end($keys); } print_r($result);

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 56
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 56
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 46
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 32
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
filename:       /in/U4ssp
function name:  (null)
number of ops:  61
compiled vars:  !0 = $arr, !1 = $set, !2 = $result, !3 = $curr, !4 = $version, !5 = $parent_version, !6 = $parent_element
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
  215     1        INIT_FCALL                                                   'usort'
          2        SEND_REF                                                     !0
          3        DECLARE_LAMBDA_FUNCTION                              ~8      [0]
  233     4        SEND_VAL                                                     ~8
  215     5        DO_ICALL                                                     
  235     6        ASSIGN                                                       !1, <array>
  236     7        ASSIGN                                                       !2, <array>
  238     8      > FE_RESET_R                                           $12     !0, ->56
          9    > > FE_FETCH_R                                                   $12, !3, ->56
  239    10    >   FETCH_DIM_R                                          ~13     !3, 'KodeRekening'
         11        ASSIGN                                                       !4, ~13
  240    12        INIT_FCALL                                                   'array_slice'
         13        INIT_FCALL                                                   'explode'
         14        SEND_VAL                                                     '.'
         15        SEND_VAR                                                     !4
         16        DO_ICALL                                             $15     
         17        SEND_VAR                                                     $15
         18        SEND_VAL                                                     0
         19        SEND_VAL                                                     -1
         20        DO_ICALL                                             $16     
         21        FRAMELESS_ICALL_2                implode             ~17     '.', $16
         22        ASSIGN                                                       !5, ~17
  242    23        ISSET_ISEMPTY_DIM_OBJ                             0          !1, !5
         24      > JMPZ                                                         ~19, ->46
  243    25    >   FETCH_DIM_W                                          $20     !1, !5
         26        ASSIGN_REF                                                   !6, $20
  244    27        ISSET_ISEMPTY_DIM_OBJ                             0  ~22     !6, 'data'
         28        BOOL_NOT                                             ~23     ~22
         29      > JMPZ                                                         ~23, ->32
         30    >   ASSIGN_DIM                                                   !6, 'data'
         31        OP_DATA                                                      <array>
  245    32    >   FETCH_DIM_W                                          $25     !6, 'data'
         33        ASSIGN_DIM                                                   $25
         34        OP_DATA                                                      !3
  246    35        INIT_FCALL_BY_NAME                                           'lastIndex'
         36        CHECK_FUNC_ARG                                               
         37        FETCH_DIM_FUNC_ARG                                   $29     !6, 'data'
         38        SEND_FUNC_ARG                                                $29
         39        DO_FCALL                                          0  $30     
         40        FETCH_DIM_W                                          $28     !6, 'data'
         41        FETCH_DIM_W                                          $31     $28, $30
         42        MAKE_REF                                             $32     $31
         43        FETCH_DIM_W                                          $27     !1, !4
         44        ASSIGN_REF                                                   $27, $32
  242    45      > JMP                                                          ->55
  248    46    >   ASSIGN_DIM                                                   !2
         47        OP_DATA                                                      !3
  249    48        INIT_FCALL_BY_NAME                                           'lastIndex'
         49        SEND_VAR_EX                                                  !2
         50        DO_FCALL                                          0  $36     
         51        FETCH_DIM_W                                          $37     !2, $36
         52        MAKE_REF                                             $38     $37
         53        FETCH_DIM_W                                          $35     !1, !4
         54        ASSIGN_REF                                                   $35, $38
  238    55    > > JMP                                                          ->9
         56    >   FE_FREE                                                      $12
  259    57        INIT_FCALL                                                   'print_r'
         58        SEND_VAR                                                     !2
         59        DO_ICALL                                                     
         60      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 22
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 37
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 22
Branch analysis from position: 40
Branch analysis from position: 22
filename:       /in/U4ssp
function name:  {closure:/in/U4ssp:215}
number of ops:  43
compiled vars:  !0 = $array1, !1 = $array2, !2 = $version_1, !3 = $version_2, !4 = $size_1, !5 = $size_2, !6 = $min_size, !7 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  215     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
  216     2        INIT_FCALL                                                   'explode'
          3        SEND_VAL                                                     '.'
          4        FETCH_DIM_R                                          ~8      !0, 'KodeRekening'
          5        SEND_VAL                                                     ~8
          6        DO_ICALL                                             $9      
          7        ASSIGN                                                       !2, $9
  217     8        INIT_FCALL                                                   'explode'
          9        SEND_VAL                                                     '.'
         10        FETCH_DIM_R                                          ~11     !1, 'KodeRekening'
         11        SEND_VAL                                                     ~11
         12        DO_ICALL                                             $12     
         13        ASSIGN                                                       !3, $12
  219    14        COUNT                                                ~14     !2
         15        ASSIGN                                                       !4, ~14
  220    16        COUNT                                                ~16     !3
         17        ASSIGN                                                       !5, ~16
  222    18        FRAMELESS_ICALL_2                min                 ~18     !4, !5
         19        ASSIGN                                                       !6, ~18
  224    20        ASSIGN                                                       !7, 0
         21      > JMP                                                          ->38
  225    22    >   FETCH_DIM_R                                          ~21     !2, !7
         23        CAST                                              4  ~22     ~21
         24        FETCH_DIM_R                                          ~23     !3, !7
         25        CAST                                              4  ~24     ~23
         26        IS_SMALLER                                                   ~22, ~24
         27      > JMPZ                                                         ~25, ->30
  226    28    > > RETURN                                                       -1
  225    29*       JMP                                                          ->37
  227    30    >   FETCH_DIM_R                                          ~26     !2, !7
         31        CAST                                              4  ~27     ~26
         32        FETCH_DIM_R                                          ~28     !3, !7
         33        CAST                                              4  ~29     ~28
         34        IS_SMALLER                                                   ~29, ~27
         35      > JMPZ                                                         ~30, ->37
  228    36    > > RETURN                                                       1
  224    37    >   PRE_INC                                                      !7
         38    >   IS_SMALLER                                                   !7, !6
         39      > JMPNZ                                                        ~32, ->22
  232    40    >   SUB                                                  ~33     !4, !5
         41      > RETURN                                                       ~33
  233    42*     > RETURN                                                       null

End of Dynamic Function 0

Function lastindex:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U4ssp
function name:  lastIndex
number of ops:  10
compiled vars:  !0 = $arr, !1 = $keys
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
  254     0  E >   RECV                                                 !0      
  255     1        INIT_FCALL                                                   'array_keys'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $2      
          4        ASSIGN                                                       !1, $2
  256     5        INIT_FCALL                                                   'end'
          6        SEND_REF                                                     !1
          7        DO_ICALL                                             $4      
          8      > RETURN                                                       $4
  257     9*     > RETURN                                                       null

End of function lastindex

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
188.96 ms | 5572 KiB | 19 Q