3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr=array( array('amount'=>100,'date'=>'2014-04-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; }); var_dump($arr); $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 = 11, Position 2 = 17
Branch analysis from position: 11
2 jumps found. (Code = 126) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/sNonA
function name:  (null)
number of ops:  22
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%2FsNonA%3A7%240'
   10     4        SEND_VAL                                                 ~4
          5        DO_ICALL                                                 
   11     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   12     9        ASSIGN                                                   !1, 0
   13    10      > FE_RESET_RW                                      $8      !0, ->17
         11    > > FE_FETCH_RW                                              $8, !2, ->17
   14    12    >   FETCH_DIM_R                                      ~9      !2, 'amount'
         13        ASSIGN_OP                                     1          !1, ~9
   15    14        ASSIGN_DIM                                               !2, 'amount'
         15        OP_DATA                                                  !1
   13    16      > JMP                                                      ->11
         17    >   FE_FREE                                                  $8
   17    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FsNonA%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/sNonA
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%2FsNonA%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.67 ms | 1400 KiB | 17 Q