3v4l.org

run code in 300+ PHP versions simultaneously
<?php function createPageLlink($name,$id,$alias,$catalias){ $link = $id . "/" . $alias . "/" . $catalias; return '<a href="' . htmlentities($link,ENT_COMPAT,"UTF-8") . '">' . htmlentities($name,ENT_COMPAT,"UTF-8") .'</a>'; } $source=json_decode('[ {"parentTitle":"Winner 2009","catTitle":"Mas Muster","title":"drm202","id":"5","alias":"item1","catalias":"first"}, {"parentTitle":"Winner 2009","catTitle":"Mas Muster","title":"drm202","id":"2","alias":"item2","catalias":"first"}, {"parentTitle":"Winner 2011","catTitle":"Josh Frank","title":"A bird in the cage","id":"6","alias":"item3","catalias":"second"}, {"parentTitle":"Winner 2011","catTitle":"Josh Frank","title":"cue & repeat","id":"7","alias":"item4","catalias":"third"}]'); $result=array(); array_walk($source,function($v,$i)use(&$result){ if(!isset($result[$v->parentTitle])) $result[$v->parentTitle]=array(); if(!isset($result[$v->parentTitle][$v->catTitle])) $result[$v->parentTitle][$v->catTitle]=array(); if(!isset($result[$v->parentTitle][$v->catTitle][$v->title])) $result[$v->parentTitle][$v->catTitle][$v->title]=array("title"=>$v->title,"id"=>$v->id,"alias"=>$v->alias,"catalias"=>$v->catalias); }); print_r($result); // just to debug echo "<ul>"; foreach($result as $key=>$sub){ echo "<li>".htmlentities($key,ENT_COMPAT,"UTF-8"); echo "\n<ul>"; foreach($sub as $k=>$s){ echo "<li>".htmlentities($k,ENT_COMPAT,"UTF-8"); echo "\n<ul>"; foreach($s as $i=>$v){ echo "<li>" . createPageLlink ($v["title"],$v["id"],$v["alias"],$v["catalias"] ) . "</li>\n"; } echo "</ul>\n</li>"; } echo "</ul>\n</li>"; } echo "</ul>";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 60
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 60
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 27, Position 2 = 57
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 57
Branch analysis from position: 28
2 jumps found. (Code = 77) Position 1 = 38, Position 2 = 54
Branch analysis from position: 38
2 jumps found. (Code = 78) Position 1 = 39, Position 2 = 54
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 54
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 57
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
filename:       /in/9ODYY
function name:  (null)
number of ops:  63
compiled vars:  !0 = $source, !1 = $result, !2 = $sub, !3 = $key, !4 = $s, !5 = $k, !6 = $v, !7 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'json_decode'
          1        SEND_VAL                                                 '%5B%0A%7B%22parentTitle%22%3A%22Winner+2009%22%2C%22catTitle%22%3A%22Mas+Muster%22%2C%22title%22%3A%22drm202%22%2C%22id%22%3A%225%22%2C%22alias%22%3A%22item1%22%2C%22catalias%22%3A%22first%22%7D%2C%0A%7B%22parentTitle%22%3A%22Winner+2009%22%2C%22catTitle%22%3A%22Mas+Muster%22%2C%22title%22%3A%22drm202%22%2C%22id%22%3A%222%22%2C%22alias%22%3A%22item2%22%2C%22catalias%22%3A%22first%22%7D%2C%0A%7B%22parentTitle%22%3A%22Winner+2011%22%2C%22catTitle%22%3A%22Josh+Frank%22%2C%22title%22%3A%22A+bird+in+the+cage%22%2C%22id%22%3A%226%22%2C%22alias%22%3A%22item3%22%2C%22catalias%22%3A%22second%22%7D%2C%0A%7B%22parentTitle%22%3A%22Winner+2011%22%2C%22catTitle%22%3A%22Josh+Frank%22%2C%22title%22%3A%22cue+%26+repeat%22%2C%22id%22%3A%227%22%2C%22alias%22%3A%22item4%22%2C%22catalias%22%3A%22third%22%7D%5D'
          2        DO_ICALL                                         $8      
          3        ASSIGN                                                   !0, $8
   15     4        ASSIGN                                                   !1, <array>
   16     5        INIT_FCALL                                               'array_walk'
          6        SEND_REF                                                 !0
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F9ODYY%3A16%240'
          8        BIND_LEXICAL                                             ~11, !1
   20     9        SEND_VAL                                                 ~11
         10        DO_ICALL                                                 
   21    11        INIT_FCALL                                               'print_r'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                                 
   22    14        ECHO                                                     '%3Cul%3E'
   23    15      > FE_RESET_R                                       $14     !1, ->60
         16    > > FE_FETCH_R                                       ~15     $14, !2, ->60
         17    >   ASSIGN                                                   !3, ~15
   24    18        INIT_FCALL                                               'htmlentities'
         19        SEND_VAR                                                 !3
         20        SEND_VAL                                                 2
         21        SEND_VAL                                                 'UTF-8'
         22        DO_ICALL                                         $17     
         23        CONCAT                                           ~18     '%3Cli%3E', $17
         24        ECHO                                                     ~18
   25    25        ECHO                                                     '%0A%3Cul%3E'
   26    26      > FE_RESET_R                                       $19     !2, ->57
         27    > > FE_FETCH_R                                       ~20     $19, !4, ->57
         28    >   ASSIGN                                                   !5, ~20
   27    29        INIT_FCALL                                               'htmlentities'
         30        SEND_VAR                                                 !5
         31        SEND_VAL                                                 2
         32        SEND_VAL                                                 'UTF-8'
         33        DO_ICALL                                         $22     
         34        CONCAT                                           ~23     '%3Cli%3E', $22
         35        ECHO                                                     ~23
   28    36        ECHO                                                     '%0A%3Cul%3E'
   29    37      > FE_RESET_R                                       $24     !4, ->54
         38    > > FE_FETCH_R                                       ~25     $24, !6, ->54
         39    >   ASSIGN                                                   !7, ~25
   30    40        INIT_FCALL                                               'createpagellink'
         41        FETCH_DIM_R                                      ~27     !6, 'title'
         42        SEND_VAL                                                 ~27
         43        FETCH_DIM_R                                      ~28     !6, 'id'
         44        SEND_VAL                                                 ~28
         45        FETCH_DIM_R                                      ~29     !6, 'alias'
         46        SEND_VAL                                                 ~29
         47        FETCH_DIM_R                                      ~30     !6, 'catalias'
         48        SEND_VAL                                                 ~30
         49        DO_FCALL                                      0  $31     
         50        CONCAT                                           ~32     '%3Cli%3E', $31
         51        CONCAT                                           ~33     ~32, '%3C%2Fli%3E%0A'
         52        ECHO                                                     ~33
   29    53      > JMP                                                      ->38
         54    >   FE_FREE                                                  $24
   32    55        ECHO                                                     '%3C%2Ful%3E%0A%3C%2Fli%3E'
   26    56      > JMP                                                      ->27
         57    >   FE_FREE                                                  $19
   34    58        ECHO                                                     '%3C%2Ful%3E%0A%3C%2Fli%3E'
   23    59      > JMP                                                      ->16
         60    >   FE_FREE                                                  $14
   36    61        ECHO                                                     '%3C%2Ful%3E'
         62      > RETURN                                                   1

Function createpagellink:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9ODYY
function name:  createPageLlink
number of ops:  25
compiled vars:  !0 = $name, !1 = $id, !2 = $alias, !3 = $catalias, !4 = $link
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    4     4        CONCAT                                           ~5      !1, '%2F'
          5        CONCAT                                           ~6      ~5, !2
          6        CONCAT                                           ~7      ~6, '%2F'
          7        CONCAT                                           ~8      ~7, !3
          8        ASSIGN                                                   !4, ~8
    5     9        INIT_FCALL                                               'htmlentities'
         10        SEND_VAR                                                 !4
         11        SEND_VAL                                                 2
         12        SEND_VAL                                                 'UTF-8'
         13        DO_ICALL                                         $10     
         14        CONCAT                                           ~11     '%3Ca+href%3D%22', $10
         15        CONCAT                                           ~12     ~11, '%22%3E'
         16        INIT_FCALL                                               'htmlentities'
         17        SEND_VAR                                                 !0
         18        SEND_VAL                                                 2
         19        SEND_VAL                                                 'UTF-8'
         20        DO_ICALL                                         $13     
         21        CONCAT                                           ~14     ~12, $13
         22        CONCAT                                           ~15     ~14, '%3C%2Fa%3E'
         23      > RETURN                                                   ~15
    6    24*     > RETURN                                                   null

End of function createpagellink

Function %00%7Bclosure%7D%2Fin%2F9ODYY%3A16%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 44
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
Branch analysis from position: 21
Branch analysis from position: 10
filename:       /in/9ODYY
function name:  {closure}
number of ops:  45
compiled vars:  !0 = $v, !1 = $i, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   17     3        FETCH_OBJ_R                                      ~3      !0, 'parentTitle'
          4        ISSET_ISEMPTY_DIM_OBJ                         0  ~4      !2, ~3
          5        BOOL_NOT                                         ~5      ~4
          6      > JMPZ                                                     ~5, ->10
          7    >   FETCH_OBJ_R                                      ~6      !0, 'parentTitle'
          8        ASSIGN_DIM                                               !2, ~6
          9        OP_DATA                                                  <array>
   18    10    >   FETCH_OBJ_R                                      ~8      !0, 'parentTitle'
         11        FETCH_OBJ_R                                      ~10     !0, 'catTitle'
         12        FETCH_DIM_IS                                     ~9      !2, ~8
         13        ISSET_ISEMPTY_DIM_OBJ                         0  ~11     ~9, ~10
         14        BOOL_NOT                                         ~12     ~11
         15      > JMPZ                                                     ~12, ->21
         16    >   FETCH_OBJ_R                                      ~13     !0, 'parentTitle'
         17        FETCH_OBJ_R                                      ~15     !0, 'catTitle'
         18        FETCH_DIM_W                                      $14     !2, ~13
         19        ASSIGN_DIM                                               $14, ~15
         20        OP_DATA                                                  <array>
   19    21    >   FETCH_OBJ_R                                      ~17     !0, 'parentTitle'
         22        FETCH_OBJ_R                                      ~19     !0, 'catTitle'
         23        FETCH_OBJ_R                                      ~21     !0, 'title'
         24        FETCH_DIM_IS                                     ~18     !2, ~17
         25        FETCH_DIM_IS                                     ~20     ~18, ~19
         26        ISSET_ISEMPTY_DIM_OBJ                         0  ~22     ~20, ~21
         27        BOOL_NOT                                         ~23     ~22
         28      > JMPZ                                                     ~23, ->44
         29    >   FETCH_OBJ_R                                      ~24     !0, 'parentTitle'
         30        FETCH_OBJ_R                                      ~26     !0, 'catTitle'
         31        FETCH_OBJ_R                                      ~28     !0, 'title'
         32        FETCH_OBJ_R                                      ~30     !0, 'title'
         33        INIT_ARRAY                                       ~31     ~30, 'title'
         34        FETCH_OBJ_R                                      ~32     !0, 'id'
         35        ADD_ARRAY_ELEMENT                                ~31     ~32, 'id'
         36        FETCH_OBJ_R                                      ~33     !0, 'alias'
         37        ADD_ARRAY_ELEMENT                                ~31     ~33, 'alias'
         38        FETCH_OBJ_R                                      ~34     !0, 'catalias'
         39        ADD_ARRAY_ELEMENT                                ~31     ~34, 'catalias'
         40        FETCH_DIM_W                                      $25     !2, ~24
         41        FETCH_DIM_W                                      $27     $25, ~26
         42        ASSIGN_DIM                                               $27, ~28
         43        OP_DATA                                                  ~31
   20    44    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F9ODYY%3A16%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.75 ms | 1411 KiB | 22 Q