3v4l.org

run code in 300+ PHP versions simultaneously
<?php $as = [ [3, 4, 2, 5, 1], ['p', 'h', 'p'], [5, 2, 1, 4, 3], ]; $x = sort_foreach($as); $y = sort_array_map($as); $z = sort_array_walk($as); var_dump($x === $y && $x === $z && $y === $z); //var_dump($x, $y, $z); function sort_foreach(array $as) { foreach ($as as $k => $a) { sort($a); $as[$k] = $a; } return $as; } function sort_array_map(array $as) { return array_map(function ($a) { sort($a); return $a; }, $as); } function sort_array_walk(array $as) { array_walk($as, function (&$a) { sort($a); }); return $as; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 18
filename:       /in/X9A5v
function name:  (null)
number of ops:  24
compiled vars:  !0 = $as, !1 = $x, !2 = $y, !3 = $z
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        INIT_FCALL_BY_NAME                                       'sort_foreach'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $5      
          4        ASSIGN                                                   !1, $5
   10     5        INIT_FCALL_BY_NAME                                       'sort_array_map'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $7      
          8        ASSIGN                                                   !2, $7
   11     9        INIT_FCALL_BY_NAME                                       'sort_array_walk'
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0  $9      
         12        ASSIGN                                                   !3, $9
   13    13        INIT_FCALL                                               'var_dump'
         14        IS_IDENTICAL                                     ~11     !1, !2
         15      > JMPZ_EX                                          ~11     ~11, ->18
         16    >   IS_IDENTICAL                                     ~12     !1, !3
         17        BOOL                                             ~11     ~12
         18    > > JMPZ_EX                                          ~11     ~11, ->21
         19    >   IS_IDENTICAL                                     ~13     !2, !3
         20        BOOL                                             ~11     ~13
         21    >   SEND_VAL                                                 ~11
         22        DO_ICALL                                                 
   41    23      > RETURN                                                   1

Function sort_foreach:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 10
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/X9A5v
function name:  sort_foreach
number of ops:  13
compiled vars:  !0 = $as, !1 = $a, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   18     1      > FE_RESET_R                                       $3      !0, ->10
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->10
          3    >   ASSIGN                                                   !2, ~4
   19     4        INIT_FCALL                                               'sort'
          5        SEND_REF                                                 !1
          6        DO_ICALL                                                 
   20     7        ASSIGN_DIM                                               !0, !2
          8        OP_DATA                                                  !1
   18     9      > JMP                                                      ->2
         10    >   FE_FREE                                                  $3
   23    11      > RETURN                                                   !0
   24    12*     > RETURN                                                   null

End of function sort_foreach

Function sort_array_map:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X9A5v
function name:  sort_array_map
number of ops:  8
compiled vars:  !0 = $as
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
   28     1        INIT_FCALL                                               'array_map'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FX9A5v%3A28%240'
   31     3        SEND_VAL                                                 ~1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
   32     7*     > RETURN                                                   null

End of function sort_array_map

Function %00%7Bclosure%7D%2Fin%2FX9A5v%3A28%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X9A5v
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
   29     1        INIT_FCALL                                               'sort'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                                 
   30     4      > RETURN                                                   !0
   31     5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FX9A5v%3A28%240

Function sort_array_walk:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X9A5v
function name:  sort_array_walk
number of ops:  8
compiled vars:  !0 = $as
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
   36     1        INIT_FCALL                                               'array_walk'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FX9A5v%3A36%241'
   38     4        SEND_VAL                                                 ~1
          5        DO_ICALL                                                 
   40     6      > RETURN                                                   !0
   41     7*     > RETURN                                                   null

End of function sort_array_walk

Function %00%7Bclosure%7D%2Fin%2FX9A5v%3A36%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X9A5v
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   RECV                                             !0      
   37     1        INIT_FCALL                                               'sort'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                                 
   38     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FX9A5v%3A36%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.31 ms | 1404 KiB | 21 Q