3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ [ 'date' => '2012-01-10', 'result' => 65, 'name' => 'Les océans', ], [ 'date' => '2012-01-11', 'result' => 75, 'name' => 'Les mers', ], [ 'date' => '2012-01-13', 'result' => 66, 'name' => 'Les continents', 'type' => 'Scores', ] ]; $array2 = [ [ 'date_end' => '2012-01-12', 'result' => 60, 'name' => 'Step#1', 'type' => 'Summary', ] ]; $result = array_merge($array1, $array2); usort($result, fn($a, $b) => ($a['date'] ?? $a['date_end']) <=> ($b['date'] ?? $b['date_end'])); var_export($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0Gd78
function name:  (null)
number of ops:  16
compiled vars:  !0 = $array1, !1 = $array2, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   22     1        ASSIGN                                                   !1, <array>
   31     2        INIT_FCALL                                               'array_merge'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !2, $5
   32     7        INIT_FCALL                                               'usort'
          8        SEND_REF                                                 !2
          9        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F0Gd78%3A32%240'
         10        SEND_VAL                                                 ~7
         11        DO_ICALL                                                 
   33    12        INIT_FCALL                                               'var_export'
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F0Gd78%3A32%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0Gd78
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        FETCH_DIM_IS                                     ~2      !0, 'date'
          3        COALESCE                                         ~3      ~2
          4        FETCH_DIM_R                                      ~4      !0, 'date_end'
          5        QM_ASSIGN                                        ~3      ~4
          6        FETCH_DIM_IS                                     ~5      !1, 'date'
          7        COALESCE                                         ~6      ~5
          8        FETCH_DIM_R                                      ~7      !1, 'date_end'
          9        QM_ASSIGN                                        ~6      ~7
         10        SPACESHIP                                        ~8      ~3, ~6
         11      > RETURN                                                   ~8
         12*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F0Gd78%3A32%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.53 ms | 1407 KiB | 19 Q