3v4l.org

run code in 300+ PHP versions simultaneously
<?php $events=array(array("date"=>"20130329","title"=>"Run","cats"=>array(array("name"=>"Cause 2","slug"=>"cause-2","sort"=>1))),array("date"=>"20130131","title"=>"Run2","cats"=>array(array("name"=>"Abused Children","slug"=>"abused-children","sort"=>2),array("name"=>"Animal Welfare","slug"=>"animal-welfare","sort"=>3),array("name"=>"Education","slug"=>"education","sort"=>1)))); $events=array_map(function($arr){ usort($arr["cats"],function($a,$b){ return $a["sort"]-$b["sort"]; }); return $arr; },$events); foreach($events as $event) { echo "Event: ".$event["title"]."\n"; foreach($event["cats"] as $cat) { echo " Cat: ".$cat["name"]."\n"; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 23
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 23
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 21
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/qplgO
function name:  (null)
number of ops:  25
compiled vars:  !0 = $events, !1 = $event, !2 = $cat
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        INIT_FCALL                                               'array_map'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FqplgO%3A3%240'
    8     3        SEND_VAL                                                 ~4
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
    3     6        ASSIGN                                                   !0, $5
    9     7      > FE_RESET_R                                       $7      !0, ->23
          8    > > FE_FETCH_R                                               $7, !1, ->23
   11     9    >   FETCH_DIM_R                                      ~8      !1, 'title'
         10        CONCAT                                           ~9      'Event%3A+', ~8
         11        CONCAT                                           ~10     ~9, '%0A'
         12        ECHO                                                     ~10
   12    13        FETCH_DIM_R                                      ~11     !1, 'cats'
         14      > FE_RESET_R                                       $12     ~11, ->21
         15    > > FE_FETCH_R                                               $12, !2, ->21
   14    16    >   FETCH_DIM_R                                      ~13     !2, 'name'
         17        CONCAT                                           ~14     '++Cat%3A+', ~13
         18        CONCAT                                           ~15     ~14, '%0A'
         19        ECHO                                                     ~15
   12    20      > JMP                                                      ->15
         21    >   FE_FREE                                                  $12
    9    22      > JMP                                                      ->8
         23    >   FE_FREE                                                  $7
   16    24      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FqplgO%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qplgO
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'usort'
          2        FETCH_DIM_W                                      $1      !0, 'cats'
          3        SEND_REF                                                 $1
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FqplgO%3A4%241'
    6     5        SEND_VAL                                                 ~2
          6        DO_ICALL                                                 
    7     7      > RETURN                                                   !0
    8     8*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FqplgO%3A3%240

Function %00%7Bclosure%7D%2Fin%2FqplgO%3A4%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qplgO
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        FETCH_DIM_R                                      ~2      !0, 'sort'
          3        FETCH_DIM_R                                      ~3      !1, 'sort'
          4        SUB                                              ~4      ~2, ~3
          5      > RETURN                                                   ~4
    6     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FqplgO%3A4%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.87 ms | 1392 KiB | 17 Q