3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "4\nfat|8\nis|5\nsomesh|10\naabb|1"; $fp = fopen('php://memory','r+'); fwrite($fp, $string); rewind($fp); //$fp = fopen("php://stdin", "r"); /* Enter your code here. Read input from STDIN. Print output to STDOUT */ while (is_resource($fp) && !feof($fp)) { $line = fgets($fp); if (strpos($line, "|") === false) { $array[$line] = ""; } else { list($value, $key) = array_map("trim", explode("|", $line)); $array[$key] = $value; } } var_dump($array); ksort($array); echo implode(" ", array_filter($array)); // aabb is fat somesh
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 46) Position 1 = 44, Position 2 = 49
Branch analysis from position: 44
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 14
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 27
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 27
2 jumps found. (Code = 46) Position 1 = 44, Position 2 = 49
Branch analysis from position: 44
Branch analysis from position: 49
Branch analysis from position: 49
filename:       /in/Cd1KE
function name:  (null)
number of ops:  65
compiled vars:  !0 = $string, !1 = $fp, !2 = $line, !3 = $array, !4 = $value, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '4%0Afat%7C8%0Ais%7C5%0Asomesh%7C10%0Aaabb%7C1'
    3     1        INIT_FCALL                                               'fopen'
          2        SEND_VAL                                                 'php%3A%2F%2Fmemory'
          3        SEND_VAL                                                 'r%2B'
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
    4     6        INIT_FCALL                                               'fwrite'
          7        SEND_VAR                                                 !1
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
    5    10        INIT_FCALL                                               'rewind'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
   11    13      > JMP                                                      ->42
   12    14    >   INIT_FCALL                                               'fgets'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $11     
         17        ASSIGN                                                   !2, $11
   13    18        INIT_FCALL                                               'strpos'
         19        SEND_VAR                                                 !2
         20        SEND_VAL                                                 '%7C'
         21        DO_ICALL                                         $13     
         22        TYPE_CHECK                                    4          $13
         23      > JMPZ                                                     ~14, ->27
   14    24    >   ASSIGN_DIM                                               !3, !2
         25        OP_DATA                                                  ''
         26      > JMP                                                      ->42
   16    27    >   INIT_FCALL                                               'array_map'
         28        SEND_VAL                                                 'trim'
         29        INIT_FCALL                                               'explode'
         30        SEND_VAL                                                 '%7C'
         31        SEND_VAR                                                 !2
         32        DO_ICALL                                         $16     
         33        SEND_VAR                                                 $16
         34        DO_ICALL                                         $17     
         35        FETCH_LIST_R                                     $18     $17, 0
         36        ASSIGN                                                   !4, $18
         37        FETCH_LIST_R                                     $20     $17, 1
         38        ASSIGN                                                   !5, $20
         39        FREE                                                     $17
   17    40        ASSIGN_DIM                                               !3, !5
         41        OP_DATA                                                  !4
   11    42    >   TYPE_CHECK                                  512  ~23     !1
         43      > JMPZ_EX                                          ~23     ~23, ->49
         44    >   INIT_FCALL                                               'feof'
         45        SEND_VAR                                                 !1
         46        DO_ICALL                                         $24     
         47        BOOL_NOT                                         ~25     $24
         48        BOOL                                             ~23     ~25
         49    > > JMPNZ                                                    ~23, ->14
   20    50    >   INIT_FCALL                                               'var_dump'
         51        SEND_VAR                                                 !3
         52        DO_ICALL                                                 
   21    53        INIT_FCALL                                               'ksort'
         54        SEND_REF                                                 !3
         55        DO_ICALL                                                 
   22    56        INIT_FCALL                                               'implode'
         57        SEND_VAL                                                 '+'
         58        INIT_FCALL                                               'array_filter'
         59        SEND_VAR                                                 !3
         60        DO_ICALL                                         $28     
         61        SEND_VAR                                                 $28
         62        DO_ICALL                                         $29     
         63        ECHO                                                     $29
   23    64      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
275.28 ms | 1400 KiB | 37 Q