3v4l.org

run code in 300+ PHP versions simultaneously
<html lang = "en"> <head> <title> Sorting </title> <meta charset = "utf-8" /> </head> <body> <?php $original = array("Fred" => 31, "Al" => 27, "Gandalf" => "wizzard", "Betty" => 42, "Frodo" => "hobbit"); ?> <h4> Original Array </h4> <?php foreach ($original as $key => $value) print("[$key] => $value <br />"); $new = $original; sort($new); ?> <h4> Array sorted with sort </h4> <?php foreach ($new as $key => $value) print("[$key] = $value <br />"); $new = $original; asort($new); ?> <h4> Array sorted with asort </h4> <?php foreach ($new as $key => $value) print("[$key] = $value <br />"); $new = $original; ksort($new); ?> <h4> Array sorted with ksort </h4> <?php foreach ($new as $key => $value) print("[$key] = $value <br />"); ?> </body> </html>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 29
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 29
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 29
2 jumps found. (Code = 77) Position 1 = 36, Position 2 = 45
Branch analysis from position: 36
2 jumps found. (Code = 78) Position 1 = 37, Position 2 = 45
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 45
2 jumps found. (Code = 77) Position 1 = 52, Position 2 = 61
Branch analysis from position: 52
2 jumps found. (Code = 78) Position 1 = 53, Position 2 = 61
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 61
Branch analysis from position: 45
Branch analysis from position: 29
Branch analysis from position: 13
filename:       /in/kSGHp
function name:  (null)
number of ops:  64
compiled vars:  !0 = $original, !1 = $value, !2 = $key, !3 = $new
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%3Chtml+lang+%3D+%22en%22%3E%0A++%3Chead%3E+%0A++++%3Ctitle%3E+Sorting+%3C%2Ftitle%3E%0A++++%3Cmeta+charset+%3D+%22utf-8%22+%2F%3E%0A++%3C%2Fhead%3E%0A++%3Cbody%3E%0A++++'
    8     1        ASSIGN                                                   !0, <array>
   12     2        ECHO                                                     '++++%3Ch4%3E+Original+Array+%3C%2Fh4%3E%0A++++'
   14     3      > FE_RESET_R                                       $5      !0, ->13
          4    > > FE_FETCH_R                                       ~6      $5, !1, ->13
          5    >   ASSIGN                                                   !2, ~6
   15     6        ROPE_INIT                                     5  ~9      '%5B'
          7        ROPE_ADD                                      1  ~9      ~9, !2
          8        ROPE_ADD                                      2  ~9      ~9, '%5D+%3D%3E+'
          9        ROPE_ADD                                      3  ~9      ~9, !1
         10        ROPE_END                                      4  ~8      ~9, '+%3Cbr+%2F%3E'
         11        ECHO                                                     ~8
   14    12      > JMP                                                      ->4
         13    >   FE_FREE                                                  $5
   17    14        ASSIGN                                                   !3, !0
   18    15        INIT_FCALL                                               'sort'
         16        SEND_REF                                                 !3
         17        DO_ICALL                                                 
   20    18        ECHO                                                     '++++%3Ch4%3E+Array+sorted+with+sort+%3C%2Fh4%3E%0A++++'
   22    19      > FE_RESET_R                                       $14     !3, ->29
         20    > > FE_FETCH_R                                       ~15     $14, !1, ->29
         21    >   ASSIGN                                                   !2, ~15
   23    22        ROPE_INIT                                     5  ~18     '%5B'
         23        ROPE_ADD                                      1  ~18     ~18, !2
         24        ROPE_ADD                                      2  ~18     ~18, '%5D+%3D+'
         25        ROPE_ADD                                      3  ~18     ~18, !1
         26        ROPE_END                                      4  ~17     ~18, '+%3Cbr+%2F%3E'
         27        ECHO                                                     ~17
   22    28      > JMP                                                      ->20
         29    >   FE_FREE                                                  $14
   25    30        ASSIGN                                                   !3, !0
   26    31        INIT_FCALL                                               'asort'
         32        SEND_REF                                                 !3
         33        DO_ICALL                                                 
   28    34        ECHO                                                     '++++%3Ch4%3E+Array+sorted+with+asort+%3C%2Fh4%3E%0A++++'
   31    35      > FE_RESET_R                                       $23     !3, ->45
         36    > > FE_FETCH_R                                       ~24     $23, !1, ->45
         37    >   ASSIGN                                                   !2, ~24
   32    38        ROPE_INIT                                     5  ~27     '%5B'
         39        ROPE_ADD                                      1  ~27     ~27, !2
         40        ROPE_ADD                                      2  ~27     ~27, '%5D+%3D+'
         41        ROPE_ADD                                      3  ~27     ~27, !1
         42        ROPE_END                                      4  ~26     ~27, '+%3Cbr+%2F%3E'
         43        ECHO                                                     ~26
   31    44      > JMP                                                      ->36
         45    >   FE_FREE                                                  $23
   34    46        ASSIGN                                                   !3, !0
   35    47        INIT_FCALL                                               'ksort'
         48        SEND_REF                                                 !3
         49        DO_ICALL                                                 
   37    50        ECHO                                                     '++++%3Ch4%3E+Array+sorted+with+ksort+%3C%2Fh4%3E%0A++++'
   40    51      > FE_RESET_R                                       $32     !3, ->61
         52    > > FE_FETCH_R                                       ~33     $32, !1, ->61
         53    >   ASSIGN                                                   !2, ~33
   41    54        ROPE_INIT                                     5  ~36     '%5B'
         55        ROPE_ADD                                      1  ~36     ~36, !2
         56        ROPE_ADD                                      2  ~36     ~36, '%5D+%3D+'
         57        ROPE_ADD                                      3  ~36     ~36, !1
         58        ROPE_END                                      4  ~35     ~36, '+%3Cbr+%2F%3E'
         59        ECHO                                                     ~35
   40    60      > JMP                                                      ->52
         61    >   FE_FREE                                                  $32
   43    62        ECHO                                                     '++%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   44    63      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.72 ms | 1400 KiB | 19 Q