3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr=array( array('amount'=>100,'date'=>'2014-03-29'), array('amount'=>120,'date'=>'2014-03-30'), array('amount'=>200,'date'=>'2014-03-31') ); usort($arr, function($a, $b) { if($a['date'] == $b['date']) return 0; return $a['date'] > $b['date'] ? 1 : -1; }); $amount = 0; foreach($arr as &$item) { $amount += $item['amount']; $item['amount'] = $amount; } var_dump($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
2 jumps found. (Code = 126) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/6nuZ0
function name:  (null)
number of ops:  19
compiled vars:  !0 = $arr, !1 = $amount, !2 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    7     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F6nuZ0%3A7%240'
   10     4        SEND_VAL                                                 ~4
          5        DO_ICALL                                                 
   12     6        ASSIGN                                                   !1, 0
   13     7      > FE_RESET_RW                                      $7      !0, ->14
          8    > > FE_FETCH_RW                                              $7, !2, ->14
   14     9    >   FETCH_DIM_R                                      ~8      !2, 'amount'
         10        ASSIGN_OP                                     1          !1, ~8
   15    11        ASSIGN_DIM                                               !2, 'amount'
         12        OP_DATA                                                  !1
   13    13      > JMP                                                      ->8
         14    >   FE_FREE                                                  $7
   17    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F6nuZ0%3A7%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6nuZ0
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        FETCH_DIM_R                                      ~2      !0, 'date'
          3        FETCH_DIM_R                                      ~3      !1, 'date'
          4        IS_EQUAL                                                 ~2, ~3
          5      > JMPZ                                                     ~4, ->7
          6    > > RETURN                                                   0
    9     7    >   FETCH_DIM_R                                      ~5      !0, 'date'
          8        FETCH_DIM_R                                      ~6      !1, 'date'
          9        IS_SMALLER                                               ~6, ~5
         10      > JMPZ                                                     ~7, ->13
         11    >   QM_ASSIGN                                        ~8      1
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~8      -1
         14    > > RETURN                                                   ~8
   10    15*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F6nuZ0%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.73 ms | 1400 KiB | 17 Q